JS跨域
调用get请求的web接口返回错误:No ‘Access-Control-Allow-Origin’ header is present on the requested resource.默认是不允许跨域调用。
- 解决方案:使用jsonp格式
$.ajax({
url: url,
type: "GET",
dateType: "JSONP",
success: function(result) {
}
});
调用get请求的web接口返回错误:No ‘Access-Control-Allow-Origin’ header is present on the requested resource.默认是不允许跨域调用。
$.ajax({
url: url,
type: "GET",
dateType: "JSONP",
success: function(result) {
}
});