Skip to content

Instantly share code, notes, and snippets.

@danilo04
Created July 29, 2013 16:34
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save danilo04/6105627 to your computer and use it in GitHub Desktop.
Jquery send ajax form serialize
// this is the id of the submit button
$("#submitButtonId").click(function() {
var url = "path/to/your/script.php"; // the script where you handle the form input.
$.ajax({
type: "POST",
url: url,
data: $("#idForm").serialize(), // serializes the form's elements.
success: function(data)
{
alert(data); // show response from the php script.
}
});
return false; // avoid to execute the actual submit of the form.
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment