Submit button comment redirecting (3 posts)

  1. Berg25
    Posted 2 years ago #

    Hello anyone reading this and sorry if I'm posting in the wrong section.

    I'm currently trying to build a website where the comments are all on 1 page.

    The problem I'm having is after you submit a comment, the page goes to the page where the comment was posted. Is there anyway after you click the submit button the comment is just posted and nothing else happens?

    I have been looking around but so far found nothing. If anyone can give me a hint or perhaps some help I would be very appreciative.

    Thank you.

  2. bcworkz
    Posted 2 years ago #

    Use jQuery to capture the submit button click and send an AJAX request instead a regular POST. Prevent the POST by changing the form action attribute to "#". Your server side AJAX handler could do the call to wp_new_comment() (after verifying it's OK for the user to do so) and respond with a false on failure in which case your jQuery script could display a message, otherwise do nothing.

  3. Berg25
    Posted 2 years ago #

    I'm pretty new at wordpress but I will try out how to do that.

    Thanks alot! I now have a direction to look to :3

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.