Jump to content

Recommended Posts

 

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

Edited by slj90
Solved
Link to comment
https://forums.phpfreaks.com/topic/307822-load-working-only-works-on-some-pages/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.