Results 1 to 2 of 2

Thread: Handling non json response in ajax submit

  1. #1
    Touch Premium Member
    Join Date
    Mar 2012
    Posts
    106
    Answers
    13
    Vote Rating
    1
      0  

    Default Answered: Handling non json response in ajax submit

    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)

    Code:
    var newForm = Ext.create('Ext.form.FormPanel');
    //submit form assigning the assembled params;
    newForm.submit({
        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.

    tia

    Harry

  2. Fixed it change from from submit to plain ajax request


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



  3. #2
    Touch Premium Member
    Join Date
    Mar 2012
    Posts
    106
    Answers
    13
    Vote Rating
    1
      0  

    Default

    Fixed it change from from submit to plain ajax request


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



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •