Problem:
When making ajax calls, if you see that your Ajax is not cross domain and you are getting following issues:1. Provisional Headers are shown in browser request headers
2. Cookies are not sent with request
Solution:
This may happen if server side you are dependent on cookie values. You need to set cache false in your Ajax call by sending following param:cache: false
So your Ajax look like this:
$.ajax({
url : "/some/resource/path/server/side",
type : "GET",
async : false,
cache: false,
success : callback,
error: errorCallback
});
url : "/some/resource/path/server/side",
type : "GET",
async : false,
cache: false,
success : callback,
error: errorCallback
});
If your Ajax is cross domain then you need add this param in your Ajax:
xhrFields : {withCredentials : true}
No comments:
Post a Comment