Submit a <form> without reloading
December 5, 2012 9:54 am Leave your thoughtsIf you have a form on your PHP-enabled website and want to submit it without reloading the page,
- Add this below the form:
<div class="success" style="display:none"> Thank you for submitting. </div> <script type="text/javascript"> if (typeof jQuery == 'undefined') { document.write('<script src="' + ( (location.protocol == 'file:') ? 'http:' : location.protocol ) + '//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">\x3C/script>'); } </script> <script src="send-form.js" type="text/javascript"></script>
- Upload the contents of send-form.zip (2 KB) to your page location.
Enjoy!
Thanks to phpmind for the original code.
Categorised in: Works
This post was written by rado