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
faissah
Posts: 6
Registered: ‎02-04-2011
My Device: Not Specified
Accepted Solution

BlackBerry WebWorks SDK for PlayBook : Webcast #2 AJAX Issue

[ Edited ]

Hi there,

 

I try to do some AjaxCall using the example in the Webcast from yesterday by i have some troubles. The readystate is stucked at 1. (I didnt forget to add the domain in config.xml)

 

Anyone has succesfully completed an ajax call ?

Retired
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: BlackBerry WebWorks SDK for PlayBook : Webcast #2 AJAX Issue

I've been able to make a successful AJAX call using the standard XMLHttpRequest object..

 

Are you using a third party library such as jQuery or Dojo to make the AJAX call?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
New Contributor
faissah
Posts: 6
Registered: ‎02-04-2011
My Device: Not Specified

Re: BlackBerry WebWorks SDK for PlayBook : Webcast #2 AJAX Issue

[ Edited ]

I tried a cross domain call with the standard XHR Object but I can figure out what's wrong. My code is very simple:

 

 

function getContent(){
 req = new XMLHttpRequest();
 req.onreadystatechange = handleResponse();
 req.send(null);
 }

 

But my ReadyState is stucked at 1...

 

My config file is

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

Retired
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: BlackBerry WebWorks SDK for PlayBook : Webcast #2 AJAX Issue

readyState = 1 means send() method has not been called.

 

Looking at your code snippet, I see a typo - there should be no closing braces at the end of the handleResponse method name.  This is a reference to the function, not a call to it.  Try changing this line to the following and trying again:

 

 

req.onreadystatechange = handleResponse;

 

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
New Contributor
faissah
Posts: 6
Registered: ‎02-04-2011
My Device: Not Specified

Re: BlackBerry WebWorks SDK for PlayBook : Webcast #2 AJAX Issue

[ Edited ]

I am pretty ashamed to admit it but that was it !! :smileyhappy:

 

Thx