View Full Version : give e mesage failure login use json

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);
Ext.Msg.alert('Warning!', 'Authentication server is unreachable : ' + action.response.responseText);

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..

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.