Store object

HI Guys,

Complete n00b with JS.

i am building a phonegapp app for my sms site and need a bit of help.

when a user has correctly entered their username and password i have some json returning with their API key.

I want to save the API key and allow the next page to store it so they can send a sms.

code on the login page

$("#callAjaxForm").on("submit", function(e){
        var $inputs = $('#callAjaxForm :input'), 
            values = {};
        $inputs.each(function() {
          values[] = this.value;
          type : "POST",
          url : "",
          data: values,
		success: function(data, status){ 
		 var obj = (data[0]);
		 if (obj.error == true) {
		   if (obj.error == false)
		   myhash = JSON.stringify(obj.message);
		   localStorage.setItem(name, myhash);
    return false;

next page has

	var myhash2 = storage.getItem(myhash);
console.log (myhash2);
if (myhash2 == "")
alert ("No Hash");
} else
alert (myhash2);


Can any one suggest a way to store the obj.message which will have their API key so it can be passed to the next page?

That is normally done via a server side language storing the value in a session variable.

The only way guaranteed to work across all currently used JavaScript browsers would be to store it in a cookie.

I would normally use PHP but as its going to be a phonegapp app i am restricted in to using javascript.

I wil try storing it as a cookie for now.


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.