jQuery post redirects to get
I have a simple ajax method in my MVC.Net project which adds entries to a calendar, but when I run the following code:
sDate = new Date(jQuery(".datepicker").val());
var args = { startdate: date.toDateString(), starttime: jQuery('#ddlFrom').val(), endtime: jQuery('#ddlTo').val() };
var action = "/EventController/AddEvent/";
jQuery.post(action, args,
function (response) {
console.log(response);
开发者_StackOverflow社区 if (response == "") {
jQuery('#js_divSuccess').show();
} else {
jQuery('#divError').text(response);
}
});
It first does the following (looking in firebug):
Why does it make a redirect on a post?
You must accidentally have the redirect (instead of forward) in that controller API on the server-side.
精彩评论