我试图实现jsonp功能,但我得到了401响应,
网站1上的代码:
goaap: function () {
$.ajax({
Authorization: '',
type: 'GET',
url: 'http://www.wedsite2.com/global/js/live.js?callback=goaa',
async: false,
contentType: "application/json; charset=utf-8",
dataType: 'jsonp',
success: function (msg) {
//do something
}
});
},
网站2上的代码:
goaa: function () {
var request = null;
while (request === null) {
request = $.ajax({
url: "default.aspx/goaa",
data: '{AID: "' + $('#details').data('aid') + '"}',
dataType: 'json',
type: "POST",
contentType: "application/json; charset=utf-8"
});
}
return request;
},
我已经看了很多例子,他们建议jsonp实现是直截了当的,我是否在实现中错过了导致401响应的内容?
来自萤火虫的额外信息:
响应:
{" Message":"处理错误时出错 。请求""堆栈跟踪":""" ExceptionType":""}
JSON:
消息"处理请求时出错。"堆栈跟踪 "" ExceptionType""
发布:JSON:AID" -1" 来源:{AID:" -1"}