我有以下代码:
$.ajax({
    type: 'POST',
    url: urlData,
    data: { OwnerId: ownerIdData, Text: textData },
    success: function (data) {
        $('#post-container').prepend(data);
    },
    error: function () {
    }
});
现在我想eval在成功函数中包含变量数据的脚本。我该怎么做?提前致谢。
编辑
我有以下表格:
<form class="new-post-form">
    <textarea id="post-creation-text-input" name="Text" rows="10"> Write something ... </textarea>
    <input type="hidden" value="@Model.OwnerId" id="post-creation-id-input"/>
    <input type="submit" value="Post" id="post-creation-submit-input" />
    <script type="text/javascript">
        $('#post-creation-submit-input').click(function (event) {
            event.preventDefault();
            var textData = $('#post-creation-text-input').val();
            var ownerIdData = $('#post-creation-id-input').val();
            var urlData = '@Url.Action("Create", "Posts")';
            $.ajax({
                type: 'POST',
                url: urlData,
                data: { OwnerId: ownerIdData, Text: textData },
                success: function (data) {
                    $('#post-container').prepend(data);
                    });
                },
                error: function () {
                }
            });
        });
    </script>
</form>
现在ajax响应如下图:
@using Facebook.Presentation.Web.Utils
@model Facebook.Presentation.Web.ViewModels.Posts.PostViewModel
<div class="post" id ="last-post">
    <h3>@Html.UserName(Model.Author)</h3>
    <br/>
    <div>
        @Html.DisplayFor(model => model.Text)
    </div>
    <br/>
    @{
        Html.RenderPartial("_CommentsPartial", Model.Comments, new ViewDataDictionary { { "ActionName", "Comment" }, { "ControllerName", "Posts" } });
    }  
</div>
此响应还包含必须评估的脚本。
再次感谢。