Hi,

I have login page with UserId , Password and Submit button. after click of submit button first time I am not getting correct result but clicking of submit button again(Second time ) get Correct result. Could you please give me a idea for resolving this problem.
My codes are :-
Store:


Ext.define("NotesApp.store.Login", {
extend: "Ext.data.Store",
requires: [
'Ext.data.proxy.JsonP', "Ext.data.Model"
],
config: {
model: "NotesApp.model.Login",
proxy:{
type:"jsonp",
startParam: '',
pageParam: '',
limitParam: '',
extraParams: {
Un: false,
Pd: false
},
},
reader:{
type:"json",
rootProperty:"res"
}
},
autoLoad:true
}
});

In Controller

onSubmitButton: function(btn, evt){


var txt = Ext.ComponentQuery.query('#txt')[0].getValue();
console.log(txt);
var pwd = Ext.ComponentQuery.query('#pwd')[0].getValue();
console.log(pwd);
var ps=Ext.getStore('Login').getAt(0).get('userPassword');
var nm=Ext.getStore('Login').getAt(0).get('ret');
console.log("return value is="+nm);
var loginStore = Ext.getStore('Login');
loginStore.getProxy().setExtraParam('Un', txt);
loginStore.getProxy().setExtraParam('Pd', pwd);
loginStore.load();


if(nm==1)
{


Ext.Msg.alert("Login in Successful");
this.activateLogin();
}
else{
Ext.Msg.alert("Enter the correct User Name and password");
}
},

Please suggest me where is wrong in above code?