View Full Version : Handling non json response in ajax submit

23 Apr 2012, 2:25 PM
I'm submitting a form via ajax, the returned results is HTML not json, I get an error about decoding non json response.

I'm created the parameters object in code, creating a form and posting the data.

It all working doing what I need to do on the back end. ( I can not control the backend output)

var newForm = Ext.create('Ext.form.FormPanel');
//submit form assigning the assembled params;
url : '/formost.php',
method : 'POST',
params : params,

In netscape I get this in the console.
'You're trying to decode an invalid JSON String: Array.....' <html follows>

The response is valid but its html, how do I deal with html, telling the submit to expect html(text) rather than json.



23 Apr 2012, 4:43 PM
Fixed it change from from submit to plain ajax request

url : '/FORMPOST.php',
method : 'POST',
params : params,
failure: function(response, opts) {
console.log('server-side failure with status code ' + response.status);