标签:解决办法 dex blog access ajax跨域 function request post方法 error:
原生ajax请求方式:
var xhr = new XMLHttpRequest(); xhr.open("POST", "http://xxxx.com/demo/b/index.php", true); xhr.withCredentials = true; //支持跨域发送cookies xhr.send();
jquery的ajax的post方法请求:
$.ajax("https://example.com/v2/whatever", { method: ‘GET‘, xhrFields: { withCredentials: true }, crossDomain: true, success: function(response){}, error: function(){} });
服务器端设置:
header("Access-Control-Allow-Credentials: true");
header("Access-Control-Allow-Origin: http://www.xxx.com");
技术交流QQ群:15129679
标签:解决办法 dex blog access ajax跨域 function request post方法 error:
原文地址:http://www.cnblogs.com/yeminglong/p/7155024.html