ocheneson
15 Feb 2008, 9:06 AM
Hello,
My php script is returning Json
can you check what is wrong in my code to process the json response ?
doLogin : function(){
//Success function for the POST Request
var success = function(o){
var status;
var usertype,fullname, email, sessionid, msg,password;
try{
}
else{
Ext.MessageBox.show({
title:'Login',
msg: "test",//'Your authentication failed, please check your credentials and try again.',
buttons: Ext.MessageBox.OK,
animEl: this.connectbtn.getEl()});
}
//Fill cookie and additional info on the client side
}catch(e){
Ext.MessageBox.show({
title:'Login',
msg: 'Error in loading the server response',
buttons: Ext.MessageBox.OK,
animEl: this.connectbtn.getEl()});
}
}.createDelegate(this);
//Failure function for the POST Request
var failure = function(o){
Ext.MessageBox.show({
title:'Login',
msg: 'Error in the login request',
buttons: Ext.MessageBox.OK,
animEl: this.connectbtn.getEl()});
};
var RecordDef = Ext.data.Record.create([
{name: 'status',}, // "mapping" property not needed if it's the same as "name"
{name: 'msg'} // This field will use "occupation" as the mapping.
]);
var myReader = new Ext.data.JsonReader({
totalProperty: "Results", // The property which contains the total dataset size (optional)
root: "rows" // The property within each row object that provides an ID for the record (optional)
}, RecordDef);
var JSstore = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: 'login.php?projectname='+Ext.state.Manager.get("projectname"),
method: 'POST',
}),
reader: myReader,
success: success,failure: failure,
fields:
});
},
thanks
olivier
My php script is returning Json
can you check what is wrong in my code to process the json response ?
doLogin : function(){
//Success function for the POST Request
var success = function(o){
var status;
var usertype,fullname, email, sessionid, msg,password;
try{
}
else{
Ext.MessageBox.show({
title:'Login',
msg: "test",//'Your authentication failed, please check your credentials and try again.',
buttons: Ext.MessageBox.OK,
animEl: this.connectbtn.getEl()});
}
//Fill cookie and additional info on the client side
}catch(e){
Ext.MessageBox.show({
title:'Login',
msg: 'Error in loading the server response',
buttons: Ext.MessageBox.OK,
animEl: this.connectbtn.getEl()});
}
}.createDelegate(this);
//Failure function for the POST Request
var failure = function(o){
Ext.MessageBox.show({
title:'Login',
msg: 'Error in the login request',
buttons: Ext.MessageBox.OK,
animEl: this.connectbtn.getEl()});
};
var RecordDef = Ext.data.Record.create([
{name: 'status',}, // "mapping" property not needed if it's the same as "name"
{name: 'msg'} // This field will use "occupation" as the mapping.
]);
var myReader = new Ext.data.JsonReader({
totalProperty: "Results", // The property which contains the total dataset size (optional)
root: "rows" // The property within each row object that provides an ID for the record (optional)
}, RecordDef);
var JSstore = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({
url: 'login.php?projectname='+Ext.state.Manager.get("projectname"),
method: 'POST',
}),
reader: myReader,
success: success,failure: failure,
fields:
});
},
thanks
olivier