Reputation: 10552
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.
Upvotes: 0
Views: 162
Reputation: 236032
$('form').bind('submit', function(e){
$.ajax({
// ...
data: $(this).serialize(),
// ...
});
e.preventDefault();
});
Upvotes: 0
Reputation: 75317
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();
});
Upvotes: 4