我写了一个使用了很多的web应用程序 $.post
用JQuery调用。现在我想发送 withCredentials: true
用它来保持会话活着,看起来像这样 $.ajax
(也是这样的):
$.ajax({
type: 'post',
url: 'http://example.com/server/api.php',
crossDomain: true,
dataType: "json",
xhrFields: {
withCredentials: true
},
data: {
username : 'test',
password : 'test'
},
success: function (d) {
$('body').html(d.status);
}
});
这是因为我现在想将PHP文件上传到我的服务器并使用Cordova导出客户端。 (withCredentials: true
仅包含因为我的localhost服务器上的测试
我可以装进去吗 $.post
打电话或我是否需要更换所有电话? (我会写一个类似于$ .post的新函数)