Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript how to stop page reload on "submit"?

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #28867
    jkendo
    Member

    Long time reader, first time poster.

    I have a contact form that is hidden when the page loads. When "contact" button (.contact_btn) is clicked, the container (#frmWrap) holding the form slides open. It works exactly as I want. Except when you submit the form, the page loads and the container is hidden again. That would be fine but because I’m using server side php to validate the form, if there was an error or you forgot to fill something in, it is now hidden until you click the contact button again to slide open the panel. Is there a way to submit that form without the page reloading? Here’s my script if it helps any.

    $(document).ready(function(){

    // hides the form container
    $("#frmWrap").hide();

    $(".contact_btn").click(function(){
    $("#frmWrap").slideToggle("slow");
    $(this).toggleClass("active"); return false;
    });

    });

    Thanks for your help

    #74824
    jkendo
    Member

    Or it would also be fine if the #frmWrap just stayed open after the submit button was clicked.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.