Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Contributor
mrugendrabhure
Posts: 2
Registered: ‎10-01-2012
My Device: 9930

OS 5 Ajax Trouble

Hi,

 

I am trying to develop a fairly simple app where the data is available as Json feed from the website and a simple html page show the data.

 

I am using PhoneGap 2.1.0,  JQuery Mobile  and WebWorks 2.3.1.5. 

 

My Config.xml

===========

<access subdomains="true" uri="*" />

 

I am faced with following two issues with my 9930 simulator for OS 5:

 

==> My ajax requests fail with "Request Timed our after  ~12000 error" for manaul XMLHttp requests.

==> The simulator while loading gives an error "Windows Command Processor Failed"

 

Here is the code I am trying out:

 

function grabFromServer(httpRequest)
{
httpConnection = new XMLHttpRequest();
var me = this;
httpConnection.onreadystatechange=function()
{
alert(httpConnection.readyState);
if(httpConnection.readyState==4 && httpConnection.status==200)
{
alert(httpConnection.responseText);
}
};
httpConnection.open("GET", httpRequest,true);
httpConnection.send();
}

 

grabFromServer("http://ideal.weblocher.com/json.php?task=getBanners");

 

Please help.

BlackBerry Development Advisor
naveenan
Posts: 101
Registered: ‎10-11-2011
My Device: BlackBerry 9810

Re: OS 5 Ajax Trouble

Hi There,

 

Here are few suggestions. 

 

First of all, instead of using the <access subdomains="true" uri="*" />, can you try  specifying the actual domain?

And also, when working with phonegap, make sure to use the blackberry version of phonegap.js.

 

Let us know if this helped or not.

 

Thanks

 

Naveen M

 

 

New Contributor
mrugendrabhure
Posts: 2
Registered: ‎10-01-2012
My Device: 9930

Re: OS 5 Ajax Trouble

HI,

 

Thanks for the reply. 

 

I had tried the <access> suggestion you made, also indeed using the blackberry version of phonegap.js.  Found that even <img> tags are not working.

 

Solved it by developing a custom phonegap plugin for downloading data and images. Images have to be base64 encoded so that the <img> tags can be fed encoded image rather than a url.

 

Thanks again. If you find a method to make the normal ajax / img src tags work, do let me know.

 

Regards,