jQuery submit form without page reload

前端 未结 4 1657
野的像风
野的像风 2021-01-25 15:37

Ok, so I\'m trying to make a new log in form form my site using jquery and classic ASP. As of right now I have a containing div in my document thats set to hidden, then when the

4条回答
  •  别那么骄傲
    2021-01-25 16:34

    To stop a form from reloading the page, this is what I use, it's been tested to work in all major browsers:

    function doStuff(e){
        e.returnValue = e.preventDefault && e.preventDefault() ? false : false;
        // handle AJAX here
    }
    

    Of course, you'll need to add an onsubmit to the form to call doStuff(event);.

提交回复
热议问题