1

I had created an ajax request in sencha touch 2, when i get a success message how can i set my return values to session and please also tell me a way through which i can get the value from session also.

 submitLoginForm: function() { var form = this.getLoginForm().getValues(); Ext.Ajax.request({ url: '../../authenticate.php', method: 'POST', params: { email: form.email, password: form.password }, success: function(response) { var json = Ext.decode(response.responseText); if(json.message == 'success') { Ext.Msg.alert('Login Success.....'); //Here i want to store return data in session } else { Ext.Msg.alert('Invalid Login Or Password.....'); } }, failure: function(response) { Ext.Msg.alert('The request failed.....'); } }); }, 

1 Answer 1

1

on Success response, use HTML5 local storage to set and get the session variables:

var sessionObject = { 'var1': 1, 'var2': 2, 'var3': 3 }; // Put the session object into storage localStorage.setItem('sessionObject ', JSON.stringify(sessionObject )); // Retrieve the session object from storage var sessionObject = localStorage.getItem('sessionObject '); console.log('sessionObject : ', JSON.parse(sessionObject )); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.