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
4wesome
Posts: 6
Registered: ‎04-26-2012
My Device: 9790

Retrieve data using ajax

I have a problem with downloading data from a web page using ajax. My query looks like this:

 

$.ajax({
    type: 'GET',
    url: 'mywebsite',
    async: false,
    jsonpCallback: 'jsonCallback',
    contentType: "application/json",
    dataType: 'jsonp',
    success: function(data) {
        $('#results').html(JSON.stringify(data));
        console.log(json);
    },
        error: function(e) {
            alert(e.message);
        }
});

What should I do if my query works in the browser, and I receives the data which I need but when I tested the code on the simulator I get the error "undefined" or the application shows a black screen for about 30 seconds and then displays a blank page without data which I needs. In my config file I have added this:


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


Any advice? Please help,

thanks!

Contributor
Perico
Posts: 10
Registered: ‎05-14-2012
My Device: 9300

Re: Retrieve data using ajax

New Contributor
4wesome
Posts: 6
Registered: ‎04-26-2012
My Device: 9790

Re: Retrieve data using ajax

I still dont know what to do :smileyfrustrated: I read carefully Your topic but I havent found a solusion. I try getting data from website. I have two possibilities to getting data. From xml file or json format. Both of them are on an external server. So, I try to getting xml data with XMLHttpRequest() but nothing happens. When I try getting json script works only in normal web browser. When I tested it on a terminal displays only a black screen. When I add domains in the config file, nothing happens. What I should changed to make it work in the above figure? Do you think I use a different method of data collection? Could anyone add your own solution, becouse now i dont know what to do.

Thanks a lot!

Contributor
Perico
Posts: 10
Registered: ‎05-14-2012
My Device: 9300

Re: Retrieve data using ajax

 

Well my code suddenly don't work again!?!?!?!?!!? I'm starting to hate the blackberry development, IOS and Android have not had many problems.

New Contributor
4wesome
Posts: 6
Registered: ‎04-26-2012
My Device: 9790

Re: Retrieve data using ajax

Let me ask the question differently... It is at all a way to retrieve text by applications from the website on blackberrySomething like sending a query and receiving the content of the website? Is isnt possible and I give up on it?

Contributor
Perico
Posts: 10
Registered: ‎05-14-2012
My Device: 9300

Re: Retrieve data using ajax

Well in blackberry simulator getJson function works sometimes, I don't understand!!!!!
Contributor
Perico
Posts: 10
Registered: ‎05-14-2012
My Device: 9300

Re: Retrieve data using ajax

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