我正在尝试解决Jquery Cross Domain问题。
使用以下代码进入IE"此页面正在访问不受其控制的信息。"
$.ajax({
type: "Post",
url: "http://Webbie/WS.asmx/TrackLink",
data: params,
contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
cache: true,
success: function (msg) {
alert('success');
},
error: function (request, status, error) {
alert('error')
}
});
我收到IE消息,一旦我批准我即将获得成功'警报。
我尝试使用以下代码将json替换为jsonp(只是将数据类型从' json'更改为' jsonp')
$.ajax({
type: "Post",
url: "http://Webbie/WS.asmx/TrackLink",
data: params,
contentType: "application/json; charset=utf-8",
dataType: "jsonp", // just added the p
async: true,
cache: true,
success: function (msg) {
alert('success');
},
error: function (request, status, error) {
alert('error')
}
});
使用上面的jsonp代码我得到错误500.
为什么我得到错误500?什么是跨域问题的最佳替代方案?