Help me, please! I made a small test with a list with ajax that brings json encode data. In the emulator XDK, it worked perfectly, but in the mobile,dont show anything.
code below:
$.ajax({
type:"GET",
url: "http://192.168.25.15/index.php/?acao=listar_categoria",
contentType: "application/json; charset=utf-8",
success: function (result, jqXHR) {
var retorno = JSON.parse(result);
$.each(retorno,function(i, categoria){
var item = '<li><h1 id="'+categoria.id+'"><img src="images/'+categoria.nome+'.png" />'+categoria.nome+'</h1></li><hr align="left">';
$("#lista").append(item);
})
}
})
ps:debug does not show errors!
連結已複製
Hi,
If you put
http://192.168.25.15/index.php/?acao=listar_categoria
In your mobile's browser, do you get something?
Check also the whitelisting options in XDK Projects / Build settings.
Regards,
Diego
Yes, Browser shows me the data!
[{"id":"4","nome":"Aulas Particulares"},{"id":"1","nome":"Casa"},{"id":"5","nome":"Cuidados Pessoais"},{"id":"3","nome":"Festas"},{"id":"6","nome":"Pets"},{"id":"2","nome":"Transporte"}]
the value of the whitelist is *
I added the file plugins and file transfer and the meta-tag
<meta http-equiv="Content-Security-Policy" content="default-src *;connect-src * style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'"/>
But but it did not work.
Any idea?
Yes, I had included both cordova.js as CORS.
I think this problem is related to the App Preview because I built the application and installed on my phone.
Conclusion, everything worked, only the App Preview that did not work.
thank you guys, great to have your help.
There are AJAX problems in the latest Cordova frameworks if you use jQuery 1.x libs, you might want to switch to jQuery 2.x libs. See this FAQ > https://software.intel.com/en-us/xdk/faqs/app-designer#ajax-jquery-one-fail
Rakshith Krishnappa (Intel) Android.
I read the faq and did what was indicated.
I changed the jquery version to version 2.0.0 and doenst work, then I put the version 2.3.3 and nothing.
I Dont use the App Designer.
My App Preview version is 2.8.1.
