JQuery.Ajax call to Asp.Net MVC JsonResult gives 12031 error, Json webservice works fine
I have the following 2 jQuery Ajax calls. The first is a call to a Asp.Net Json Webservice and always works. The second is a call to a ASP.Net MVC action that return an json result. This call always fails with Status=12031 the first time the page is loaded. The responseText is empty. After a refresh de second call usually works fine.
jQuery(document).ready(function () {
jQuery.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "/Services/MenuService.svc/Get",
dataType: "json",
data: '{}',
success: function (data) {
jQuery.map(data.d, function (item) {
jQuery("#menu").append('<li><a href="/Menu/开发者_StackOverflow中文版' + item.Link + '">' + item.Link + '</a></li>')
});
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
if (XMLHttpRequest.responseText != '') {
alert(XMLHttpRequest.responseText);
}
}
});
jQuery.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "/Menu/Get",
dataType: "json",
data: '{}',
success: function (data) {
jQuery.map(data, function (item) {
jQuery("#menu").append('<li><a href="/Menu/' + item.Link + '">' + item.Link + '</a></li>')
});
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
if (XMLHttpRequest.responseText != '') {
alert(XMLHttpRequest.responseText);
}
}
});
});
Does anyone knows why I get the 12031 Status on the second call?
This seems to be an issue ith the default Visual Studio 2010 development server. I am now running with IIS Express 7.5 with Visual Studion 2010 sp1 beta and I can't replicate the problem.
精彩评论