从我的html页面调用MVC webservice时,它总是出错;请帮助我跨域Ajax调用
$.ajax({
type: "GET",
url: url,
contentType: "application/json; charset=utf-8",
crossDomain: true,
dataType: "json",
success: function (msg) {
alert(Response.ErrorMessage)
},
error: function (e, status) {
alert(e + " Fail " + status)
}
});
你试过'dataType:“jsonp”'? 你得到哪个错误信息? – MaiKaY
你不需要'crossDomain:true,'或'contentType:“application/json; charset = utf-8”,' –
首先打开** javascript调试控制台**并寻找错误消息。接下来,仍然在您的** javascript调试控制台**中,查看发生的网络请求,以查看您的服务器是否返回了您的预期结果。 –