我在我的应用程序中使用MVC4 anf knockoutjs。我正在使用jquery弹出窗口进行用户登录,成功登录后,我想仅仅引用“_LoginPartial”而不是完整的页面。 Currenlty我使用以下代码:
//Ajax call from JS file
$.get('@Url.Action("PartialUpdate", "Account")',{}, function (data) {
$("#_LoginPartial").html(data);
});
// in Account Controller
public ActionResult PartialUpdate(){
return PartialView("_LoginPartial");
}
在上面的代码中,它首先返回完整的登录页面,第二次返回相应的数据,但“_LoginPartial”没有更新。有人可以指导我............
答案 0 :(得分:0)
尝试将.get切换为.ajax
$.ajax({ url: "@(Url.Action("Action", "Controller"))", type: "POST", cache: false, async: true, data: { id: 'id' }, success: function (result) { $(".Content").html(result); } });