Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Previous Successful JS Code worked, now no more to change popup on success of service request

Hello! You have codeif(data.response==="true") {
$.mobile.changePage("load_submitted.html", {transition: "pop"});
}
else {
$.mobile.changePage("load_not_submitted.html", {transition: "pop"});/code
but it should be
codeif(data.response==="true") {
$.mobile.changePage("load_submitted.html", {transition: "pop"});
}
else {
$.mobile.changePage("load_not_submitted.html", {transition: "pop"});
}/code
there is closing bracket missing in the end.

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Previous Successful JS Code worked, now no more to change popup on success of service request

yes i see. Now, its letting me in the page finally, however the server is supposed to return a "-1" as an integer if the response represents a bad id, and if its a good id then the id will be "1" or greater.

The way its working with this code its saying the server is returning a # other than '"-1" always even if its not supposed to. Something is still wrong.

if(data.response=="-1") {
$.mobile.changePage("profile_not_saved.html", {transition: "pop"});
}
else {
$.mobile.changePage("profile_saved.html", {transition: "pop"});
}

I have two "==" for an integer (in the 1st line: "if(data.response=="-1") {..."), is that correct? I even tried it with just one "=". But with just one "=" the result is always going to "profile_not_saved.html" no matter if its returning a "-1" or a number equal to "1" or greater. ?

I dont know what else could be wrong. Is the "-1" throwing this code off somehow or is there a different way to write this JS to make this work?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Previous Successful JS Code worked, now no more to change popup on success of service request

If there is a number in data.response then it's better to use codeif(+data.response == -1)/code
unary plus will change data.response to a number and double equals sign compare numbers.

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Previous Successful JS Code worked, now no more to change popup on success of service request

nope. I tried it and with many other variations and still doesnt work, i tried all of these:

if(+data.response == -1)
if(data.response == -1)
if(+data.response=="-1")
if(data.response=="-1")

any other ideas?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Previous Successful JS Code worked, now no more to change popup on success of service request

Please run codeconsole.log(data.response);/code and
codeconsole.log(data);/code
then please post what you have there in console.

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Previous Successful JS Code worked, now no more to change popup on success of service request

uhmmm? run it how and where? Please be more specific?

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Previous Successful JS Code worked, now no more to change popup on success of service request

Hello,

You should paste:
code
console.log(data.response);
console.log(data);
/code
before:
code
if(data.response=="-1") {
$.mobile.changePage("profile_not_saved.html", {transition: "pop"});
}
else {
$.mobile.changePage("profile_saved.html", {transition: "pop"});
}
/code

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Previous Successful JS Code worked, now no more to change popup on success of service request

heres a snap shot:

Image

and heres the block of code:

<!DOCTYPE html SYSTEM

Code: Select all

         profile_saved 

     <!-- css -- 

     <!-- css -- 

     <!-- css -- 

         <!-- mobileheader -- 

                 Saved 

         <!-- mobilecontainer -- 

             <!-- mobilelabel_2 -- 

                 Your Profile Changes Have Been Saved 

             <!-- mobilebutton_3 -- 
             a class="  mobilebutton17" name="mobilebutton_3" rel="nofollow" 
             OK 
             /a 

GET http://appery.io/app/preview/2c00f358...

200 OK
106ms
jquery-1.8.2.js (line 8416)
ParamsHeadersResponseCookies

/*

  • JS for profile_saved generated by Appery.io
    *

  • Created on: Tuesday, June 11, 2013, 04:17:58 PM (PDT)
    */

    /* Setting project environment indicator */
    Appery.env = "web";

    Appery.getProjectGUID = function() {
    return '2c00f358-abf9-4385-90d9-fd734b2f70ce';
    }

    Appery.getTargetPlatform = function() {
    return '0';
    }

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

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

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

    function setDetailContent(pageUrl) {
    Appery.setDetailContent(pageUrl);
    }

    /*

  • Services
    */
    var getDriverCompletedLoads = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'get',
    });
    var getDispatchActiveLoads = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'get',
    });
    var driver_picked_up = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'post',
    'contentType': 'application/json',
    });
    var getDriverActiveLoadsList = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'get',
    });
    var getCompletedLoads = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'get',
    });
    var dispatch_sign = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'post',
    'contentType': 'application/x-www-form-urlencoded',
    });
    var getActiveLoad = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'get',
    });
    var getPendingLoads = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'get',
    });
    var getDispatchActiveLoad = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'get',
    });
    var getTruckInfo = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'get',
    });
    var getDriverNames = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'get',
    });
    var getDriverCompletedLoad = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'get',
    });
    var camera1 = new Appery.CameraService({});
    var accept_load = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'post',
    'contentType': 'application/json',
    });
    var UpdateStatus = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'post',
    'contentType': 'application/json',
    });
    var getDriverPendingLoads = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'get',
    });
    var getLoadCompleted = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'get',
    });
    var deny_load = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'post',
    'contentType': 'application/json',
    });
    var getAvailableTrucks = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'get',
    });
    var driver_profile = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'post',
    'contentType': 'application/json',
    });
    var submit_load = new Appery.RestService({
    'url': 'http://appery.io/app/rest/tunnel',
    'dataType': 'json',
    'type': 'post',
    'contentType': 'application/json',
    });

    //createSpinner("http://appery.io/app/resources/previe...");
    Appery.AppPages = [{
    "name": "confirmed_pickup",
    "location": "confirmed_pickup.html"
    }, {
    "name": "dispatch_pending_loads",
    "location": "dispatch_pending_loads.html"
    }, {
    "name": "take_pic1",
    "location": "take_pic1.html"
    }, {
    "name": "driver_pending_loads",
    "location": "driver_pending_loads.html"
    }, {
    "name": "success_submit_load",
    "location": "success_submit_load.html"
    }, {
    "name": "home_all",
    "location": "home_all.html"
    }, {
    "name": "driver_completed_loads",
    "location": "driver_completed_loads.html"
    }, {
    "name": "pending_loads",
    "location": "pending_loads.html"
    }, {
    "name": "profile_not_saved",
    "location": "profile_not_saved.html"
    }, {
    "name": "dispatch_active_loads",
    "location": "dispatch_active_loads.html"
    }, {
    "name": "history",
    "location": "history.html"
    }, {
    "name": "truck_info",
    "location": "truck_info.html"
    }, {
    "name": "dispatch_login_fail",
    "location": "dispatch_login_fail.html"
    }, {
    "name": "load_submitted",
    "location": "load_submitted.html"
    }, {
    "name": "profile_saved",
    "location": "profile_saved.html"
    }, {
    "name": "assign_load",
    "location": "assign_load.html"
    }, {
    "name": "no_pending_loads",
    "location": "no_pending_loads.html"
    }, {
    "name": "status",
    "location": "status.html"
    }, {
    "name": "no_active_loads",
    "location": "no_active_loads.html"
    }, {
    "name": "active_loads",
    "location": "active_loads.html"
    }, {
    "name": "no_completed_loads",
    "location": "no_completed_loads.html"
    }, {
    "name": "completed_loads",
    "location": "completed_loads.html"
    }, {
    "name": "dispatch_active_load",
    "location": "dispatch_active_load.html"
    }, {
    "name": "not_confirmed_pickup",
    "location": "not_confirmed_pickup.html"
    }, {
    "name": "dispatch_home",
    "location": "dispatch_home.html"
    }, {
    "name": "status_updated",
    "location": "status_updated.html"
    }, {
    "name": "Homescreen",
    "location": "Homescreen.html"
    }, {
    "name": "dispatch_signin",
    "location": "dispatch_signin.html"
    }, {
    "name": "load_docs_take_pics",
    "location": "load_docs_take_pics.html"
    }, {
    "name": "available_trucks",
    "location": "available_trucks.html"
    }, {
    "name": "driver_active_loads",
    "location": "driver_active_loads.html"
    }, {
    "name": "load_completed",
    "location": "load_completed.html"
    }, {
    "name": "driver_profile",
    "location": "driver_profile.html"
    }, {
    "name": "load_not_submitted",
    "location": "load_not_submitted.html"
    }];

    j_621_js = function(runBeforeShow) { /* Object & array with components "name-to-id" mapping */
    var n2id_buf = {
    'mobilelabel_2': 'j_625',
    'mobilebutton_3': 'j_626'
    };

    if ("n2id" in window && window.n2id !== undefined) {
    $.extend(n2id, n2id_buf);
    } else {
    window.n2id = n2id_buf;
    }

    Appery.CurrentScreen = 'j_621';

    /*

    • Nonvisual components
      */
      var datasources = [];

      /*

      • Events and handlers
        */
        j_621_beforeshow = function() {
        Appery.CurrentScreen = 'j_621';
        for (var idx = 0; idx < datasources.length; idx++) {
        datasources[idx].__setupDisplay();
        }
        }
        // screen onload
        screen_2053_onLoad = j_621_onLoad = function() {
        screen_2053_elementsExtraJS();

        j_621_windowEvents();
        screen_2053_elementsEvents();
        }

        // screen window events
        screen_2053_windowEvents = j_621_windowEvents = function() {
        $('#j_621').bind('pageshow orientationchange', function() {
        adjustContentHeightWithPadding();
        });

        }

        // screen elements extra js
        screen_2053_elementsExtraJS = j_621_elementsExtraJS = function() {
        // screen (screen-2053) extra code

        }

        // screen elements handler
        screen_2053_elementsEvents = j_621_elementsEvents = function() {

        $("a :input,a a,a fieldset label").live({
        click: function(event) {
        event.stopPropagation();
        }
        });

        $('#j_624 [name="mobilebutton_3"]').die().live({
        click: function() {
        if (!$(this).attr('disabled')) {
        Appery.navigateTo('Homescreen', {
        transition: 'pop',
        reverse: false
        });

        Code: Select all

         } 

},
});

Code: Select all

 } 

 $("#j_621").die("pagebeforeshow").live("pagebeforeshow", function(event, ui) { 
     j_621_beforeshow(); 
 }); 

 if (runBeforeShow) { 
     j_621_beforeshow(); 
 } else { 
     j_621_onLoad(); 
 } 

}

$("#j_621").die("pageinit").live("pageinit", function(event, ui) {
Appery.processSelectMenu($(this));
j_621_js();
});

John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Previous Successful JS Code worked, now no more to change popup on success of service request

I think it was missing the first part, here it is:

<!DOCTYPE html SYSTEM

Code: Select all

         profile_saved 

     <!-- css -- 

     <!-- css -- 

     <!-- css -- 

         <!-- mobileheader -- 

                 Saved 

         <!-- mobilecontainer -- 

             <!-- mobilelabel_2 -- 

                 Your Profile Changes Have Been Saved 

             <!-- mobilebutton_3 -- 
             a class="  mobilebutton17" name="mobilebutton_3" rel="nofollow" 
             OK 
             /a
John Herdean
Posts: 0
Joined: Tue May 14, 2013 3:56 am

Previous Successful JS Code worked, now no more to change popup on success of service request

oops or maybe not. I guess it was all in the 1st big block i sent, sorry...

Return to “Issues”