언어 설정

Menu
Sites
Language
jquery ajax timing out

I'm trying to do a simple ajax call (on ref device 210, Tizen 2.1) and it keeps timing out without a success or complete. The ref device is connected via wifi and I can surf to different sites. The window.open() function works fine as well,

Are there any special settings in the project I need to set to allow ajax calls? The code is html, jquery. Below is a code chunk that shows what I'm attempting:

var BaseURL = 'https://api.intel.com:8081';

function GetAuthCode(outPutText) {
    jQuery.support.cors = true;
    var URL = BaseURL + '/identity/v2/authcode';
    var PostData = 'state=' + id + '&client_id=' + APIKey;
    $(outPutText).val("Requesting Authorization Code...");
    $.ajax({
        url: URL,
        type: "POST",
        data: PostData,
        dataType: "json",
        success: function(data, textStatus, jqxhr) {
            console.log("GetAuthCode() success")
            $(outPutText).val(jqxhr.responseText);
            AuthCode = data;
        },
        complete: function(jqxhr, textStatus) {
            console.log("GetAuthCode() complete: " + textStatus);
            $(outPutText).val(textStatus);            
        },
        error: function(jqxhr, textStatus, errorThrown) {
            console.log("GetAuthCode() error: " + errorThrown);
            $(outPutText).val("Error: "+errorThrown);
        },
        timeout: 60000
    });
}

Any help would be greatly appreciated,

-Chuck

Edited by: Brock Boland on 17 3월, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

2 댓글
Vineet Tiwari
hi try this sample ajax code it is working in 2.1 emulator at present there is a problem with my device so i tried it in emulator. var theUrl='https://pais-dev.zypr.net/api/v2/weather/forecast/?token=14941239b3fa26429fd411e93c162d4a3f5958faa35b43456&placename=hyderabad'; var request = $.ajax({ type: 'GET', url: theUrl, dataType: 'json', data: {}, async: true, cache: false, }); request.success(function (msg) { var forecastWeather = jQuery.parseJSON(request.responseText); console.log("current weather after parse" +forecastWeather); // callback(jQuery.parseJSON(request.responseText)); console.log("high temp"+forecastWeather.response.data[0].weather_forecast[0].high_temp); console.log("high temp"+forecastWeather.response.data[0].weather_forecast[0].low_temp); }); add * in "access" of config.xml file
Hi Vineet, "add * in "access" of config.xml file" was the piece I was missing. My ajax calls are working now. Thanks for your help! -Chuck