通过在jQuery对象中传递xhrFields属性,我可以使用$.ajax发出跨域AJAX请求。
xhrFields: {
withCredentials: true
}我想优化速度,但是,所以想测试它的香草JS看看哪个更快。如何在不使用像withCredentials这样的库的情况下设置jQuery (或类似于普通JS的)?
发布于 2014-06-12 15:53:21
var xhr = new XMLHttpRequest();
xhr.open("GET", "myserver.com");
xhr.withCredentials = true;
xhr.send();请注意,与使用jQuery发送请求相比,上述操作的速度不会明显加快。
https://stackoverflow.com/questions/24188151
复制相似问题