Converting AJAX call to avoid cross-domain problems

Go To


I m trying to convert the following code to another AJAX call, in order to not have cross-domain problems!

This is my original code:

        $(document).ready(function() {
            $("#os").load(' #livesos');
            var refreshId = setInterval(function() {
               $("#os").load(' #livesos');
            }, 60000);
            $.ajaxSetup({ cache: false });

And here is a sample code for what i want to do, but i dont know how...

type: "GET",
cache: false,
url: '',
dataType: "???",

Can someone help me please?

2012-04-04 01:32
by zuperakos
If your javascript is not from then you will still have a problem - James Black 2012-04-04 01:36
and what should i do? i want to use this code in phonegap for iphone app.. - zuperakos 2012-04-04 01:37


Your best bet to avoid cross-domain issues is to have the phone call your server, and the server can call the other servers to get the data needed.

There are a couple of benefits to this, one being that you can cache recent calls, if it doesn't change often, and more quickly send it back to the client.

Also, if you want to later change the url or make additional calls to return richer data, you can do that without affecting the client.

2012-04-04 01:44
by James Black
Thank you for your reply! Could you give some info how i can do this? : - zuperakos 2012-04-04 01:48
Rather than making a url connection to, just have it make a get/post request to your server, and your server would then need to make these calls - James Black 2012-04-04 12:13