I'm working on an offline-capable application and I'd like to do an ajax call to $.get() a file on the domain that I will be caching.
Will the call still work if I'm offline? I would presume no, but I wondered if I included the static page in the offline cache if it would somehow still work.
Since the Ajax applications communicate with the Hub via the server, you cannot operate the Hub via applications in the case of Internet connection failure.
There is however a better solution – caching AJAX requests. Although we can use a standard caching solution provided by HTTP (yes, Ajax is cached by HTTP), there is a catch: It works for GET requests only (not POST). Furthermore, you cannot control cache expiration on the application side.
10. Which of the following technology is not used by Ajax? Flash is not used by Ajax.
The $.get() method requests data from the server with an HTTP GET request. Syntax: $.get(URL,callback); The required URL parameter specifies the URL you wish to request.
Short answer: Yes.
If you have the file in the application cache, then all HTTP GET requests (including Ajax) will go through the cache. You can think of an Ajax GET request as an ordinary browser page load, but the results are delivered to your code rather than directly to the user.
You can cache the responses into local storage and use the saved one when offline. See more on how to make this automatic here: http://myok12.wordpress.com/2011/08/19/building-an-almighty-data-retrieval-system-for-all-html5-webapps/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With