I have come across questions related to preventing caching in jQuery, but I am specifically looking for a solution for jQueryMobile and PhoneGap using JSONP. My aim is to make ajax calls that dynamically populate a listview, querying the web service every time the page initializes (pageinit). However, on my Android device, each new query results in data being added to the listview without deleting the previous data, leading to duplicates. I suspect this issue is related to caching. To address it, I have included the following code snippet:
$(document).bind('pageinit', function() {
$.ajaxSetup ({
cache: false
});
});
While this prevents caching in Chrome and Safari browsers, it does not seem to work on Android devices. How can I prevent caching on Android devices?
PS. Although similar, this question is not the same: How to prevent caching from jQuery Ajax?