Ajax call failed from BlackBerry OS5 phonegap application

why is this ajax call not working on my BB OS5 and working on BB OS6 +

$("#HomePg").on('pageinit', function(event) { $.ajax({ dataType:'json', url: serviceURL+'linka', error: function(xhr, status, error) { alert("Cannot Connect to the Specified URL : "+status); }, success: function(json) { $.each(json, function(i, object) { var cr = "<li id='menuList'><a id="+object.id+" data-transition='slide' class='menuClass' ><img src=css/images /"+object.id+".png /> <h3> "+object.menuname+" </h3></a></li>"; $("#mainMenu").append(cr); $("ul").listview("refresh"); mainloaded = true; }); }, timeout:60000, retryMax: 10 }); }); 

.... config.xml

 <access subdomains="true" uri="*"/> <rim:connection timeout="60000"> <id>TCP_WIFI</id> <id>TCP_CELLULAR</id> <id>BIS-B</id> <id>MDS</id> <id>WAP2</id> <id>WAP</id> </rim:connection> 

.........

I use jqm 1.1.1 version with jquery 1.7.2 it works on BB OS6+

+4
source share
1 answer

Sorted by:

Looks like BB OS5 has a problem with jQuery-Ajax . For those trying to use the same attempt using XMLHttpRequest.

 $("#homePg").on('pageinit', function(event) { var url = serviceURL+'testgroups' http.open("GET", url, true); http.onreadystatechange = function() {//Call a function when the state changes. if(http.readyState == 4 && http.status == 200) { //alert(http.responseText); var json = JSON.parse(http.responseText); $.each(json, function(i, object) { var cr = "<li id='menuList'><a id="+object.id+" data-transition='slide' class='menuClass' ><img src=css/images/"+object.id+".png /> <h3> "+object.menuname+" </h3></a></li>"; $("#mainMenu").append(cr); $("ul").listview("refresh"); $.mobile.hidePageLoadingMsg(); mainloaded = true; }); } } http.send(null); }); 
+2
source

All Articles