评估ajax响应中的脚本

我有以下代码:

$.ajax({ type: 'POST', url: urlData, data: { OwnerId: ownerIdData, Text: textData }, success: function (data) { $('#post-container').prepend(data); }, error: function () { } }); 

现在我想在成功函数中eval变量数据中包含的脚本。 我是怎么做到的? 提前致谢。

编辑

我有以下表格:

 
$('#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 () { } }); });

现在ajax响应是以下视图:

 @using Facebook.Presentation.Web.Utils @model Facebook.Presentation.Web.ViewModels.Posts.PostViewModel 

@Html.UserName(Model.Author)


@Html.DisplayFor(model => model.Text)

@{ Html.RenderPartial("_CommentsPartial", Model.Comments, new ViewDataDictionary { { "ActionName", "Comment" }, { "ControllerName", "Posts" } }); }

此响应还包含必须评估的脚本。

再次感谢。

使用jQuery.getScript()函数。 文档: http : //api.jquery.com/jQuery.getScript/