Skip to content Skip to sidebar Skip to footer

Ajax: Form Submit To Post Comments

I'm having an issue getting a form to submit and display the comment without the page refreshing (in-place) but when I click on the button, it takes me to the top of the page but d

Solution 1:

This works:

$(document).ready(function() {
    //var form = $('#form');//var submit = $('#submit');

    $('#submit').on('click', function(e) {
        e.preventDefault(); 
        // the rest of your code goes here
    })
});

Solution 2:

Your jQuery event handler refers to an non-existent jQuery object. Try replacing the first line of the event handler with this:

form.on('submit', function(e) {

Post a Comment for "Ajax: Form Submit To Post Comments"