EXTJS 4 How to get Json response back on success of submit in form? -
i able see json response in firebug , when decode action of form on success giving undefined .
{ xtype: 'form', x: 30, y: 520, height: 80, bodypadding: 10, title: 'myuploadform', fileupload: true, standardsubmit: false, autoheight: true, bodystyle: 'padding: 10px 10px 10px 10px;', labelwidth: 50, items:[{ xtype: 'fileuploadfield', id: 'filedata', emptytext: 'select document upload...', fieldlabel: 'file', buttontext: 'browse' }], buttons: [{ text: 'upload', handler: function() { var form = this.up('form').getform(); if(form.isvalid()){ alert("submit"); form.submit({ url: 'myurl' waitmsg: 'uploading file...', success: function (form,action) { var data= ext.json.decode(action.response.responsetext); alert("success: " + data.msg); ext.msg.alert('success', action.result.message); }, failure: function (form, action) { var data = ext.decode(action.response.responsetext); alert("failure: " + data.msg); } }); } } }] }
my url returns json response want handle in success of submit . if tried pls let me know
try plain javascript way
var data= json.parse(action.response.responsetext);
or extjs 3.x way
var data= ext.util.json.decode(action.response.responsetext);
for extjs 4 , above
var data= ext.json.decode(action.response.responsetext);
Comments
Post a Comment