i developing app via phonegap , must read external xml file have lot of important information app.
i tried code below, getting annoying error. after searching everywhere did not find solutions.
the jquery code:
$(document).ready(function(){ $.ajax({ url: 'http://servicos.cptec.inpe.br/xml/cidade/233/condicoesatuaisuv.xml', success: function(data) { console.log('ok') }, error: function() { console.log('problem') } }); }); the damm error:
cross-origin request blocked: same origin policy disallows reading remote resource @ http://servicos.cptec.inpe.br/xml/cidade/233/condicoesatuaisuv.xml. (reason: cors header 'access-control-allow-origin' missing).
i read necessary enable cors, how do that?
thanks attention!
on phonegap, need use white list access more 1 server. cors advice getting correct theme, not correct solution - phonegap.
note: read on this. many people have been tripped up. there difference. of month (july 2015), versions after 4.0 , leading edge version require plugin. (i don't have correct details on this, you'll have read.)
whitelist guide 4.0
http://docs.phonegap.com/en/4.0.0/guide_appdev_whitelist_index.md.html
whitelist guide 3.3
http://docs.phonegap.com/en/3.3.0/guide_appdev_whitelist_index.md.html
some details here:
http://community.phonegap.com/nitobi/topics/which-whitelist-plugin-should-pgb-user-to-use http://community.phonegap.com/nitobi/topics/pgb-support-which-whitelist-function
Comments
Post a Comment