I'm using jquery ajax in my mobile app to fetch my json data via restful apis. My restful apis have been configured to support etags. My restful apis are hosted on another subdomain, so I have configured CORS to handle the cross domain calls. In my dev environment, I have configured my mobile app to run on test.domain.com and the restful apis to run in test2.domain.com so that I can test the cross domain calls. All of this works great! My ajax calls behave exactly as I would expect with the etags:
Make a call to get json content:
$.ajax({
ifmodified: true,
....
success: function(data){
}
I get a status 200 and the data variable in the success callback has the data. Make another call to the same resource (not expecting any changes) I get a status 304 and the data variable in the success callback has the data (loaded from cache).
So far so good.
Now if I configure my dev environment to have both my mobile app and restful apis on the same domain, here is where I run in to problems.
$.ajax({
ifmodified: true,
....
success: function(data){
}
I get a status 200 and the data variable in the success callback has the data. Make another call to the same resource (not expecting any changes) I get a status 304 and the data variable in undefined!!!!
Any thoughts why with this configuration jquery won't populate the data variable with what is in cache? I also removed CORS and the crossdomain setting in my ajax call, but still no luck. I'm using jquery 1.7.1.