Monday, 19 August 2013

JQuery Post URL

JQuery Post URL

I have the following Jquery function
function refreshTheGrid(myData, ceduleDateFrom, ceduleDateTo, paramOrderNo) {
var myData2 = {
CeduleDateFrom: ceduleDateFrom,
CeduleDateTo: ceduleDateTo,
ParamOrderNo: paramOrderNo
};
var theUrl = "UpdateCheckBox";
var theUrl2 = "";
$.ajax({
type: "POST",
url: theUrl,
data: myData,
dataType: "text",
success: function (data) {
$.ajax({
type: "POST",
url: theUrl2,
data: myData2,
dataType: "text",
success: function (data) {
$('#monbouton').click();
}
})
}
})
popup.Hide();
void (0);
}
My Application is http://localhost/JprMvc/
when my POST Method are called the following is capture by Fiddler2
POST /JprMvc/CeduleGlobale/UpdateCheckBox HTTP/1.1
and
POST /JprMvc/ HTTP/1.1
I had a problem with the call until I removed the CeduleGlobale part from
my URL. Now everything works.
I think it's a routing problem, but I am not sure.
my routing is
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "CeduleGlobale", action = "Index", id =
UrlParameter.Optional } // Parameter defaults
);
It works now, but it seems arbitrary.
Should I remove the defaults from my routing and put it back in the jquery.
What am i missing ?

No comments:

Post a Comment