标签:npc size ons cross 跨域请求 url font function iba
请求如下:
$.ajax({
type: "GET",
async:false,
url: "http://127.0.0.1:8080/Cross-site-request/crosssite",
dataType: "jsonp",
data: {"value":"123"},
jsonpCallback:"callback",
success: function(data) {
console.log(data);
},
error: function(XMLHttpRequest, textStatus, errorThrown){
alert(XMLHttpRequest.status);
alert(XMLHttpRequest.readyState);
alert(textStatus);
}
});
}
返回字符串构造如下
callback([{"name":"Alibaba","company":"MY"},{"name":"Tencent","company":"MHT"},{"name":"baidu","company":"LYH"},{"name":"JD","company":"LQD"}])
注意(敲黑板)
jsonpCallback:"callback", 和 返回的callback() 对应
标签:npc size ons cross 跨域请求 url font function iba
原文地址:http://www.cnblogs.com/anyehome/p/7906776.html