slj90 Posted October 28, 2018 Share Posted October 28, 2018 I am using the following code to load mysql data: <div id="station_data" style="width:100%"></div> and $(document).ready(function(){ loadstation(); }); function loadstation(){ $("#station_data").load("http://website.co.uk/celebs/loadstation.php"); setTimeout(loadstation, 1000); } This works fine on my PC on multiple pages, however when testing on my iPhone and iPad it works on one page, but the exact same code doesn't work on another page. Whilst trying to get it to work I made an exact copy of the working page with a different name and it doesn't work, even though the code is exactly the same. Could it be something to do with the cache? I have tried adding a random number at the end of the URL function loadstation(){ newrnd = Math.random(); the_url = "http://website.co.uk/celebs/loadstation.php?s=" + newrnd; $("#station_data").load(the_url); setTimeout(loadstation, 1000); } I have added PHP headers header("Cache-Control: no-cache"); header("Pragma: no-cache"); And also tried turning the cache off $.ajaxSetup ({ // Disable caching of AJAX responses cache: false }); I don't understand why the same code is working on one page but not another? This problem is only on iPhone/iPad. Changing the url to just ./loadstation.php got it working Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.