Languages

Menu
Sites
Language
Starting multiple ajax request causes the emulator to freeze and crash

I am starting up two ajax request on startup, even before UI initialization. It all worked fine and dandy on the web simulator, but on emulator, the app freezes and then crashes the emulator. I am using the Tizen SDK 2.2.1. Anyone has any idea of why is this happening?

Responses

3 Replies
talari praveen kumar

Hi

I tested with two ajax calls like this

 var request = $.ajax({
        type: 'GET',
        url: 'https://pais-dev.zypr.net/api/v2/weather/forecast/?token=xxxxxxxxx&placename=Hyderabad"',
        dataType: 'json',
        data: {},
        async: true,
        cache: false,
    });
    request.success(function (msg) {
         var request1 = $.ajax({
                type: 'GET',
                url: 'https://pais-dev.zypr.net/api/v2/weather/current/?token=xxxxxxxx&placename=Hyderabad"',
                dataType: 'json',
                data: {},
                async: true,
                cache: false,
            });
         request1.success(function (msg) {
             var currentWeather = jQuery.parseJSON(request1.responseText);
                console.log("current temp"+currentWeather.response.data[0].weather_current.current_temp);
         }); 
         request1.fail(function (jqXHR, textStatus) {
                console.log( "Request1 failed: " + textStatus );         
            });
        var forecastWeather = jQuery.parseJSON(request.responseText);
        console.log("high temp"+forecastWeather.response.data[0].weather_forecast[0].high_temp);
        var d = new Date();
        var day= d.getDay();
        console.log(day);});
    request.fail(function (jqXHR, textStatus) {
        console.log( "Request failed: " + textStatus );         
    });

and it worked for me without any issues. Will you please share your code so that i can test what the problem is?

Imgen Tata

I think maybe I need to give you my app package to let you help, can I send you email privately?

Imgen Tata

Thanks for your test, I now finally figured out the reason why the app freezes at startup, it's because I am using location api to get location, but the emulator will not be able to determine a location unless I inject one with Event Injector of Tizen IDE, I personally think this is a major issue with Tizen toolchain as that for starter like me, it takes a long time to realize that since debugging on emulator is not working right now. So I have to rely on logging and other technique. Anyway, it's resolved now. Again, thanks for your help.