PDA

View Full Version : give e mesage failure login use json



saifulloh
26 Aug 2012, 8:44 PM
i have a json :

{"success":false,"jml":2,"pesan":"Username Tersedia, Password salah"}

and script for extjs :

failure:function(form, action){
if(action.failureType == 'server'){
obj = Ext.util.JSON.decode(action.response.responseText);
Ext.Msg.alert('Login Failed!', obj.pesan);
}else{
Ext.Msg.alert('Warning!', 'Authentication server is unreachable : ' + action.response.responseText);
}
formLogin.getForm().reset();
}

i use firebug, message error :
TypeError: Ext.util.JSON is undefined



obj = Ext.util.JSON.decode(action.response.responseText);




please help me.. what must i do ??? thanks..

vietits
26 Aug 2012, 11:27 PM
The error "Ext.util.JSON is undefined" tells the thing. There is no Ext.util.JSON but Ext.JSON, so change your code to use Ext.JSON.decode() or Ext.decode(). The latter is shorthand for the first one.