我正在撥打AJAX
調用,然後從控制器返回PartialView
將其填充到div
中。Ajax調用不返回部分視圖
下面是我的代碼: -
var file = document.getElementById("file").files[0];
jq.ajax({
type: "POST",
url: '/Main/getData',
data: formData,
dataType: 'json',
contentType: false,
processData: false,
success: function (response) {
jq('#partialPlaceHolder').html(response);
},
error: function (error) {
alert("Some Error Occured");
}
});
[HttpPost]
public ActionResult getData(FormCollection form)
{
......
return PartialView("_pageMain", retMod);
}
正如我在調試器的代碼,沒有錯誤,直到結束,但仍是AJAX拋出alert("Some Error Occured")
。
部分視圖未在div中填充。如何解決這個問題?
您是否嘗試過'JSON.stringify(formData)'或查看開發人員工具中的響應內容? – adricadar 2015-03-25 12:57:36
partialview html或json? – progsource 2015-03-25 12:58:22
PartialView是.cshtml ...我已經在我的其他模塊中使用它,它在那裏工作....因爲我張貼在這裏'文件',所以它給錯誤.. – Anup 2015-03-25 13:02:32