【发布时间】:2012-03-19 05:56:44
【问题描述】:
我有一个看起来像这样的 jquery 函数
function MonitorLoadStatus(loadId) {
var url = 'LoadAdmin/GetLoadStatus/' + loadId;
$.get(url, function (data) {
if (data != "complete") {
$("img[id =" + loadId + "]").show();
window.setTimeout(function () {
MonitorLoadStatus(loadId);
}, 1000);
}
else {
$("img[id =" + loadId + "]").hide();
};
});
}
还有一个看起来像这样的 MVC 方法
public ActionResult GetLoadStatus(string loadId)
{
// check some thing and return stuff
return Content(currentProgress);
}
上述方法的 loadid 从 jquery get 方法作为 null 传递。我到底做错了什么
【问题讨论】:
-
您的 loadId 是否有效,您是否尝试过执行 console.log(loadId);在 $.get() 方法之前...?
-
是的 loadId 在 $.get() 方法之前被正确传递
标签: asp.net-mvc jquery get