ajax跨域原创
原创在这个坑旁边太多次了。在这个坑旁边太多次了,55555
后台加:
header(Access-Control-Allow-Credentials: true); header(*"Access-Control-Allow-Origin: ");_//允许ajax_跨域 header(Access-Control-Allow-Methods:GET, POST, OPTIONS**);
前端ajax代码:
$.ajax({ url: "xxx", type: "POST", data: {}, dataType: "json", xhrFields: { withCredentials: true }, crossDomain: true, error: function () {
},
complete: **function** () {
},
success: **function** (getdata) {_//__如果调用__php__成功_
}
})
版权声明
所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除
上一篇:php前后端通过json数据传值转载 下一篇:vue项目搭建流程