Problem jQuery Ajax.post method doesn't work. The problem I was facing is that when I was trying post ajax request to the server with type "POST", the form input values were not going to the server instead I was getting null for each input element. The same code works in other browser but not in the Internet Explorer.
$.ajax({
type: "POST",
url: 'http://localhost:28206/api/PersonalDetails/PostPersonalDetails',
data: JSON.stringify(PersonalDetails),
contentType: "application/json;charset=utf-8",
processData: true,
success: function (data, status, xhr) {
alert("The result is : " + status);
},
error: function (xhr) {
alert(xhr.responseText);
}
}); Solution After spending a lot of time in search engines and digging a lot to the subject, finally found the solution. The internal mechanism of the IE doesn't allow POST method of Ajax so we need to keep a
meta http-equiv element in the head to ensure that the IE behaves like previous version not the latest version.
So keep below code inside <head></head> of your page
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9">
and the same code that was not working in Internet Explorer earlier will start working.
Hope this will help someone facing the similar problem.
Regards,
Sheo Narayan
http://www.dotnetfunda.com