I have jquery function which looks like this
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();
};
});
}
and an MVC method which looks like this
public ActionResult GetLoadStatus(string loadId)
{
// check some thing and return stuff
return Content(currentProgress);
}
The loadid to the above method is being passed as null from the jquery get method. What exactly am i doing wrong
Make sure you have a route in your Global.asax which has a
/{loadId}at the end. I remind you that the default route looks like this:meaning that the parameter should be called
idin your controller action:If you want to use
loadIdupdate your route definitions accordingly.