做项目遇到 记录下 以免忘记json跨域请求报错,错误信息No 'Access-Control-Allow-Origin' header is present on the requested resource
处理手段:使用jsonp格式, ajax请求参数dataType:'JSONP'。
代码格式:
$.ajax({
url: "http://.......",
type: 'GET',
dataType: 'JSONP',//here
success: function (data) {
}
});