jQuery Mobile Hosted on Server 1 and Retrieve Data from Server 2 -
i have simple jquery mobile application hosted on server 1. includes php pages query database hosted on server 2.
this works fine when (jquery mobile website , database) hosted on same server when separated doesn't display of data. php page queries database , retrieves 20 records outputs these html, e.g.:
<div data-role="content"> <ul data-role="listview" data-filter="true"> <? echo $output; ?> </ul> </div> $output php variable list view of records in format jquery mobile expects.
anyone know how can php page work when hosted on server 1 accessing data hosted on server 2.
i think problem security related - when database on server 2 jquery mobile preventing request due related cross domain requests? i'm getting un "unknown error" when attempting retrieve data database isn't particularly helpful.
if put same getcontacts.php page on server 1 , remove jquery mobile components it straight php page queries database on server 2 , outputs html works perfectly.
update: found page: http://jquerymobile.com/demos/1.2.0/docs/api/globalconfig.html
which discussed allowcrossdomainpages option set false default. try overriding , setting true not sure how - know how set override? i'm not familiar jquery unfortunately, using jquery mobile is.
in case, php header('access-control-allow-origin: http://server2.example.com') should work (put on page jquery making request - @ top of page before content sent)
Comments
Post a Comment