ajax跨域原创

原创
小哥 3年前 (2022-11-08) 阅读数 109 #PHP
文章标签 PHP

在这个坑旁边太多次了。在这个坑旁边太多次了,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__成功_

}

})

版权声明

所有资源都来源于爬虫采集,如有侵权请联系我们,我们将立即删除

热门