Ajax跨域

//region 跨域
function GetPersonList()
{
$.ajax({
type: "get",
async: false,
url: "GetPerson",
dataType: "jsonp",
jsonp: "callback",
success: function (p) {
//var p = getObject(json); //这里要注意下,jsonp返回之后jQuery会直接转成js对象,不用再转了。
$("#div1").text("姓名:" + p.Name + "年龄:" + p.Age);
alert(p.Name);
},
error: function () {
alert('跨域失败!');
}

})
}
//endregion

原文地址:https://www.cnblogs.com/xgyweb/p/6169771.html