tags:

views:

22

answers:

2

Hi, it it possible to get the form action of a GET form on submit including all of the get variables added on the end?

The reason being I want to use AJAX to run the script that the form submits to, and then just display a thank you message.

+4  A: 

jQuery makes this extremely easy: http://api.jquery.com/serialize/.

$('#your-form').bind('submit', function (event) {
  jQuery.get('your-url.php', $(this).serialize(), function (response) {
    alert("Woo");
  });

  event.preventDefault();
});
Matt
A: 
$('form').bind('submit', function(e){
   $.ajax({
      // ...
      data: $(this).serialize(),
      // ...
   });
   e.preventDefault();
});

Kind Regards

--Andy

jAndy