Page 1 of 1

localStorage.item

Posted: Mon Jan 07, 2013 3:34 am
by David Fung

I created a local storage variable "displayStatus" via the builder UI. Refer to the picture where the "status" is a boolean data field stored in parse.com.

Image

Upon the rest service execute completion, I added the following JS but nothing happened. Why?

var alertStatus = localStorage.getItem("displayStatus");

if (alertStatus == true){
Tiggzi('labelAlert').show();
Tiggzi('contactNo').show();
alert("Please call owner");
};


localStorage.item

Posted: Mon Jan 07, 2013 5:28 am
by maxkatz

Check the if-statement. alertStatus is string but being compared to true (boolean).


localStorage.item

Posted: Mon Jan 07, 2013 6:59 am
by David Fung

Thanks for your support. The issue is resolved.
One more question. What is the syntax of serviceInstanceName.execute? I can't execute the REST service i this JS.

var alertStatus = localStorage.getItem("displayStatus");

if (alertStatus == "true"){
Tiggzi('labelAlert').show();
Tiggzi('contactNo').show();

serviceInstanceName.execute({'geoUpdate'});
serviceInstanceName.execute({'locationUpdate'});
};


localStorage.item

Posted: Mon Jan 07, 2013 7:26 am
by David Fung

I got it. Thanks!

....
...
geoUpdate.execute({});
locationUpdate.execute({});
};