Support » Plugin: Forms: 3rd-Party Integration » ‘Unexpected token < in JSON at position 0' echoed after posting

  • Hello Zaus and everybody,

    I’m integrating with an auto-responder service, and my goal is to catch the response,
    extract the success url, and redirect to it.

    Integration works OK (thanks for the great plugin by the way), so now I simply need
    to catch the response, grab (somehow) the url which is in the ‘Location’ parameter of
    the response header and redirect user to it: (‘Location” just below the red frame):

    For that purpose, I created a custom action using the 3rd-party folder to aid me in creating the code (mailchimp code – thanks for this too, was very helpful to a noob like me!), and after saving my functions.php went ahead and made a submission.

    What happened?
    The submissions was once again successfully delivered to the 3-rd party, and in addition, I’m getting ‘Unexpected token < in JSON at position 0’ just beneath my form a few secs after clicking ‘Submit’:
    THe post arrives at the 3rd party OK and the action fails.

    According to this:

    it seems that server is returning Content-Type: text/html while plugin is expecting JSON.
    Could that be correct?

    Am I missing something?
    How can I make theis awesome plugin receive non JSON response and extract the Location param value from the header?

    Thanks a lot, your help much appreciated

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author zaus


    The new message you’re seeing is the Ajax response from cf7 with a PHP warning or something in what should be json. There’s probably something “wrong” with your hook – open the browser dev tools (inspect or f12) and check out the “network” or “console” tab before you submit the form to see what it’s returning.

    Thanks zaus, I found a JS way to submit to another form – hope this helps someone in the future 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘‘Unexpected token < in JSON at position 0' echoed after posting’ is closed to new replies.