我有一个web服务“someWebServiceOnServer”,它发回一个json响应和一个Cookie。如果我通过浏览器打这个网址,我看到以下内容:Cookie未保存在Sencha Touch 2中
{"IsAuth":true,"Message":"","UserName":"guest"}
如果我检查网页资源 - >饼干,我看到一个Cookie集。
现在在我的煎茶触摸2个应用,我如下调用Ajax:
Ext.Ajax.request({
url: 'someWebServiceOnServer',
useDefaultXhrHeader: false,
callback: function(options, success, response) {
console.log(response.responseText)
},
});
在运行,我得到JSON响应预期。但是cookie没有设置。此外,我无法在响应头中找到cookie。为什么会发生?
注意:CORS已在服务器上实现,我的应用程序可以访问此服务。我没有使用withCredentials: true,
,因为这会引发错误XMLHttpRequest cannot load . Cannot use wildcard in Access-Control-Allow-Origin when credentials flag is true.
。
我的浏览器已启用Cookies。
我需要cookie,因为我将进行后续调用,将此cookie信息发送回服务器。
问题是否解决?如果是,你能分享你的解决方案吗? – ThinkFloyd
嗨,我有同样的问题,你能否提出一个解决方案?非常感谢! – GibboK
看看这个http://stackoverflow.com/questions/11616523/cookie-not-saved-in-sencha-touch-2-application?answertab=active#tab-top它基本上'withCredentials:true,useDefaultXhrHeader:false ' – ThinkFloyd