You are here

29 June 2011

This snippet sends form with id contactform using ajax via post method. When it's send and result is returned. It writes result into #feedback-form.

Source code viewer
  1. (function($) {
  2. $().ready(function() {
  3. $("form").submit(function(e){
  4. e.preventDefault();
  5. $.post(
  6. $(this).attr("action"),
  7. $(this).serialize(),
  8. function(data){
  9. // do this when submit complete
  10. }
  11. );
  12. return false;
  13. });
  14. });
  15. })(jQuery);
Programming Language: jQuery