jQuery Mobile Hosted on Server 1 and Retrieve Data from Server 2

  You are currently not logged in. You can view the forums, but cannot post messages. Log In | Register

27-May-13 06:05
I have a simple jQuery Mobile application that is hosted on one server (server1.com) which includes some php pages that query a database hosted on another server (server2.com).

This all works fine when everything (jQuery Mobile website and Database) is hosted on the same server but when they are separated it doesn't display any of the data. I've been looking at the Configuring Defaults documentation at:

http://api.jquerymobile.com/global-config/

and specifically the allowCrossDomainPages option. I've created a new script file called custom-scripting.js which contains the following:



$(document).bind("mobileinit", function(){
$.extend( $.mobile , {
allowCrossDomainPages: true
});
});



and the called it as recommended:



<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="custom-scripting.js"></script>
<script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>



but my PHP page is still not making the request to server2.com. I was hoping that setting allowCrossDomainPages: true would allow the PHP page to make the request to the external server.

Anyone else setup a similar configuration with jQuery Mobile that needs to retrieve data from an external server using php?
27-May-13 16:48
javascript HAS to be running in the context of the same domain it is hosted on.

--
Chris.
So long, and thanks for all the fish.
http://webmaster-talk.eu/

 
New posts
Old posts

Follow Elated