24、Ext.util.JSON is undefined 问题的解决方案

关于Extjs通过Ajax提交后,返回值为json类型的问题的解决:
问题:

Ext.Ajax.request({ url:'data/delete.php?opt=ckilist', method:'post', params:{ tb_ckiSign:ckiRecord.get('tb_ckiSign') }, success:function(response, options){ var responseArray = Ext.util.JSON.decode(response.responseText); Ext.Msg.alert('提示信息',responseArray.msg); } });

后台打印的数据如下:
{'success':'true','msg':'删除成功'}
然后,前台无法获取后台的值,此外在firebug中报错:TypeError: Ext.util.JSON is undefined 
解决方案
将上边红色字体不部分改为:
var responseArray = Ext.JSON.decode(response.responseText);  

就是将 util删除掉。问题产生的原因也许是因为Extjs4 和Extjs3等做了变动。请大家注意。

你可能感兴趣的:(24、Ext.util.JSON is undefined 问题的解决方案)