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
Contributor
Perico
Posts: 10
Registered: ‎05-14-2012
My Device: 9300
Accepted Solution

getJSON request in jquery mobile does not work on Blackberry App

I have an small jquery mobile app for blackberry platform. In Ripple emulator, Chrome plugin, works fine all the getJSON request, but in RIM Simulator (blackberry 9300) with the app make by PhoneGap Build the getJSON request don't retrieve the data, show the loading spinner in infinite loop.
Could be something in the configuration file? Thanks a lot for any help!

Please use plain text.
Developer
rorybarnes
Posts: 214
Registered: ‎01-07-2011
My Device: Bold 9900

Re: getJSON request in jquery mobile does not work on Blackberry App

Did you setup an access element for the domain you are making the request to? You need to whitelist any domains your app needs to contact. Ripple doesn't enforce this rule.

 

<access uri="http://www.mydomain.com" subdomains="true">
   <feature id="blackberry.app.event" required="true" version="1.0.0"/>
</access>

 

https://bdsc.webapps.blackberry.com/html5/documentation/ww_developing/Access_element_834677_11.html

--
Rory (@roryboy)
Click "Accept as Solution" if post solved your original issue. Give like/thumbs up if you feel post is helpful
Please use plain text.
Contributor
Perico
Posts: 10
Registered: ‎05-14-2012
My Device: 9300

Re: getJSON request in jquery mobile does not work on Blackberry App

Thank you! But is "blackberry.app.event" or "blackberry.pim.memo" for blackberry smartphone? I write "<access uri="*" subdomains="true"> but seems don't. How can I open google maps URL in blackberry browser? Thanks, thanks, thanks!
Please use plain text.
Retired
astanley
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: getJSON request in jquery mobile does not work on Blackberry App

There also may be an issue of cross-site-scripting.  Read this post on how to enable $.support.cors = true:

 

http://stackoverflow.com/questions/7852225/is-it-safe-to-use-support-cors-true-in-jquery

 

 

You want to launch the browser from your WebWorks app?  You can do that using the blackberry.invoke and blackberry.invoke.BrowserArguments API.  Here is the documentation, as well as a code sample:

https://bdsc.webapps.blackberry.com/html5/apis/blackberry.invoke.BrowserArguments.html

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Please use plain text.
Contributor
Perico
Posts: 10
Registered: ‎05-14-2012
My Device: 9300

Re: getJSON request in jquery mobile does not work on Blackberry App

Thanks astanley! Now I can open browser from my app! But sometimes the Ajax request don't work in blackberry simulator (I don't have a phone) and I don't understand why if I don't change the code!
Please use plain text.
Contributor
Perico
Posts: 10
Registered: ‎05-14-2012
My Device: 9300

Re: getJSON request in jquery mobile does not work on Blackberry App

I tested the application on a real phone, model 9300, and all work correctly, the simulator is not reliable.

Please use plain text.