It's the first time I've used Ajax with Channel Form so this maybe a newbie question.

I'm loading the template containing my form via AJAX and appending it to a DIV. When the form is submitted I want to show messaging in the same DIV so I'm overriding the default form submit in jQuery but I can't prevent the page from refreshing. If I set the form parameter ajax="yes" then it simply redirects to JSON output.

What am I missing?

Static form ID works fine:

<form id="comment-form">
          <input type="text">
          <button type="submit">Submit</button>

Channel Form ID does not work:


jQuery code:

$("#comment-form").on('submit', function (e) {

1 Answer 1


json="yes" parameter is merely changing format of data output. You will need to add appropriate Javascript code to handle submission and displaying of results.

See example in the docs. You can use it as the base but change code that is producing alert to code that will show success/error message in same div (e.g. using jQuery's .html() function)

  • Hi Yuri, thanks for your comment. The bizarre thing is I have a jQuery event handler preventing the form from submitting but it is not working. If I create a static form with the same ID it does work, but it does not work for the same ID on the Channel Form. I will update my original post with the code.
    – KoalaKid
    Nov 25, 2015 at 1:09
  • You might be getting some javascript conflict. Check you browser console for errors. Nov 25, 2015 at 7:53
  • I think the parameter should be json="yes" not ajax="yes"
    – mjr
    Dec 17, 2015 at 22:28
  • @mjr, you're right Dec 18, 2015 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.