Phonegap access origin error resolved

Phongap storage work on :
– Local storage
– SQL Storage
– Memeory Storage

Sometime or more of the time we require to call our external servers APIs REST/SOAP .

I tried also during my first api call on phonegap ,wasted around 1 day to resolve error for this, below are the steps you need to follow:

– Laod or call any jquery function after device ready event.
– use $.getJSON(uri,function(data){});
instead $.ajax();[require jsonp and server callback] so avoid this hactic work
– on load event add
$(function(){
$.support.cors = true;
}
);

– whitelist your server address on config.xml file , say
– At server end add header in response header('Access-Control-Allow-Origin: *');

Its done, any missing step will result in server or call error!

contact us