gonadn
Posts: 0
Joined: Wed Apr 03, 2013 11:03 pm

Rest Services "json" call is not working when i run windows phone/phonegap project in visual studion 2010

Hi

Iam having problom to call/invoke the rest service to get json data. When i run project in tiggzi evry thing works fine and i can se my data. But when i download the project and run it in Visual Studio 2010 as Phonegap, it dosent work. I added javascript method "success" and "Error" and when i run project in tiggzi i get success, and when i run same project in Visual Stuio 2010 i get "Error".

Did i miss something in configuring the rest service or i have to do something before i run the project in VS?

Thanks in addvanced for helping me out of this issue.

Regard
gonadn

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

Rest Services "json" call is not working when i run windows phone/phonegap project in visual studion 2010

In addition to error callback, do you get any information about the error, such as message?

gonadn
Posts: 0
Joined: Wed Apr 03, 2013 11:03 pm

Rest Services "json" call is not working when i run windows phone/phonegap project in visual studion 2010

Hi Max

I was just trieng to find out how to get more desc message, iam new to javascript...
The method below is just giving message 'Error'......?
here is my code:
'onError': function(jqXHR, textStatus, errorThrown) {
alert('Failed' + testStatus.toString());
},

gonadn
Posts: 0
Joined: Wed Apr 03, 2013 11:03 pm

Rest Services "json" call is not working when i run windows phone/phonegap project in visual studion 2010

Here is my JavaScript file:

Tiggzi.env = "apk";
Tiggzi.getProjectGUID = function() {
return '';
}
Tiggzi.getTargetPlatform = function() {
return 'W';
}

function navigateTo(outcome, useAjax) {
Tiggzi.navigateTo(outcome, useAjax);
}

function adjustContentHeight() {
Tiggzi.adjustContentHeight();
}

function adjustContentHeightWithPadding() {
Tiggzi.adjustContentHeightWithPadding();
}

function setDetailContent(pageUrl) {
Tiggzi.setDetailContent(pageUrl);
}
/**********************

  • SECURITY CONTEXTS *
    *******************/
    /****************************
  • SERVICE SETTINGS *
    *****************************/
    /**********************
  • SERVICES *
    **********************/
    var ParnerGymNyheter = new Tiggr.RestService({
    'url': '',
    'dataType': 'json',
    'type': 'get',
    });
    createSpinner("res/lib/jquerymobile/images/ajax-loader.gif");
    Tiggzi.AppPages = [{
    "name": "Screen1",
    "location": "#j_0"
    }, {
    "name": "Partnergym",
    "location": "#j_13"
    }];
    j_13_js = function(runBeforeShow) { / Object & array with components "name-to-id" mapping /
    var n2id_buf = {
    'mobileimage_2': 'j_17',
    'mobilebutton1_39': 'j_18'
    };
    if ("n2id" in window && window.n2id !== undefined) {
    $.extend(n2id, n2id_buf);
    } else {
    window.n2id = n2id_buf;
    }
    Tiggr.CurrentScreen = 'j_13';
    /**********************
    • NONVISUAL COMPONENTS *
      **********************/
      var datasources = [];
      // Tiggzi Push-notification registration service
      /*********************
      • EVENTS AND HANDLERS *
        *********************/
        j_13_beforeshow = function() {
        Tiggzi.CurrentScreen = 'j_13';
        for (var idx = 0; idx < datasources.length; idx++) {
        datasources[idx].__setupDisplay();
        }
        }
        // screen onload
        screen_3671_onLoad = j_13_onLoad = function() {
        screen_3671_elementsExtraJS();
        j_13_deviceEvents();
        j_13_windowEvents();
        screen_3671_elementsEvents();
        }
        // screen window events
        screen_3671_windowEvents = j_13_windowEvents = function() {
        $('#j_13').bind('pageshow orientationchange', function() {
        adjustContentHeightWithPadding();
        });
        }
        // device events
        j_13_deviceEvents = function() {
        document.addEventListener("deviceready", function() {});
        }
        // screen elements extra js
        screen_3671_elementsExtraJS = j_13_elementsExtraJS = function() {
        // screen (screen-3671) extra code
        }
        // screen elements handler
        screen_3671_elementsEvents = j_13_elementsEvents = function() {
        $("a :input,a a,a fieldset label").live({
        click: function(event) {
        event.stopPropagation();
        }
        });
        $('#j_16 [name="mobilebutton1_39"]').die().live({
        click: function() {
        if (!$(this).attr('disabled')) {
        Tiggr.navigateTo('Screen1', {
        transition: 'flip',
        reverse: false
        });
        }
        },
        });
        }
        $("#j_13").die("pagebeforeshow").live("pagebeforeshow", function(event, ui) {
        j_13_beforeshow();
        });
        if (runBeforeShow) {
        j_13_beforeshow();
        } else {
        j_13_onLoad();
        }
        }
        $("#j_13").die("pageinit").live("pageinit", function(event, ui) {
        Tiggzi.processSelectMenu($(this));
        j_13_js();
        });
        j_0_js = function(runBeforeShow) { / Object & array with components "name-to-id" mapping /
        var n2id_buf = {
        'mobilegrid_4': 'j_4',
        'mobilegridcell_5': 'j_5',
        'mobileimage_9': 'j_6',
        'mobilegridcell_6': 'j_7',
        'lblTitle': 'j_8',
        'lblText': 'j_9'
        };
        if ("n2id" in window && window.n2id !== undefined) {
        $.extend(n2id, n2id_buf);
        } else {
        window.n2id = n2id_buf;
        }
        Tiggr.CurrentScreen = 'j_0';
        /**********************
      • NONVISUAL COMPONENTS *
        **********************/
        var datasources = [];
        restservice1 = new Tiggr.DataSource(ParnerGymNyheter, {
        'onComplete': function(jqXHR, textStatus) {
        $t.refreshScreenFormElements("j_13");
        },
        'onSuccess': function(data) {
        alert('success');
        },
        'onError': function(jqXHR, textStatus, errorThrown) {
        alert('Failed');
        },
        'responseMapping': [{
        'PATH': ['$'],
        'ID': 'mobilegrid_4',
        'SET': [{
        'PATH': ['Title'],
        'ID': 'lblTitle',
        'ATTR': '@'
        }, {
        'PATH': ['Text'],
        'ID': 'lblText',
        'ATTR': '@'
        }]
        }],
        'requestMapping': [{
        'PATH': ['X-Tiggzi-Database-Id'],
        'HEADER': true,
        'ATTR': ''
        }]
        });
        datasources.push(restservice1);
        // Tiggzi Push-notification registration service
        /*********************
      • EVENTS AND HANDLERS *
        ************************/
        j_0_beforeshow = function() {
        Tiggzi.CurrentScreen = 'j_0';
        for (var idx = 0; idx < datasources.length; idx++) {
        datasources[idx].__setupDisplay();
        }
        }
        // screen onload
        screen_042F_onLoad = j_0_onLoad = function() {
        screen_042F_elementsExtraJS();
        try {
        restservice1.execute({})
        } catch (ex) {
        console.log(ex.name + ' ' + ex.message);
        hideSpinner();
        };
        j_0_deviceEvents();
        j_0_windowEvents();
        screen_042F_elementsEvents();
        }
        // screen window events
        screen_042F_windowEvents = j_0_windowEvents = function() {
        $('#j_0').bind('pageshow orientationchange', function() {
        adjustContentHeightWithPadding();
        });
        }
        // device events
        j_0_deviceEvents = function() {
        document.addEventListener("deviceready", function() {});
        }
        // screen elements extra js
        screen_042F_elementsExtraJS = j_0_elementsExtraJS = function() {
        // screen (screen-042F) extra code
        }
        // screen elements handler
        screen_042F_elementsEvents = j_0_elementsEvents = function() {
        $("a :input,a a,a fieldset label").live({
        click: function(event) {
        event.stopPropagation();
        }
        });
        }
        $("#j_0").die("pagebeforeshow").live("pagebeforeshow", function(event, ui) {
        j_0_beforeshow();
        });
        if (runBeforeShow) {
        j_0_beforeshow();
        } else {
        j_0_onLoad();
        }
        }
        $("#j_0").die("pageinit").live("pageinit", function(event, ui) {
        Tiggzi.processSelectMenu($(this));
        j_0_js();
        });
gonadn
Posts: 0
Joined: Wed Apr 03, 2013 11:03 pm

Rest Services "json" call is not working when i run windows phone/phonegap project in visual studion 2010

Oki, finally i get a proper desc of error message:

Image

gonadn
Posts: 0
Joined: Wed Apr 03, 2013 11:03 pm

Rest Services "json" call is not working when i run windows phone/phonegap project in visual studion 2010

i think it has something todo with cordova.js script, i changed it to version cordova 2.5.0 and i dident get the error above. But still iam not getting my data rendered, i se blank white page...?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Rest Services "json" call is not working when i run windows phone/phonegap project in visual studion 2010

Hi,

Did you test your app in Desktop browser?

In the JavaScript you've provided there is a collection "ParnerGymNyheter". But collection name contains the typo. An incorrect collection name might cause the 404 error.

gonadn
Posts: 0
Joined: Wed Apr 03, 2013 11:03 pm

Rest Services "json" call is not working when i run windows phone/phonegap project in visual studion 2010

Hi Katya

Yes i tested app in desktop browser, and its working in the browser. Buit when i download the code as Windows Phone VS project and try to run it in VS it wont work and i get the message above, Collection name contains typo?!! i dont it is incorrect collection because it is working in the browser. or...?

Thanks for helping :)

Return to “Issues”