Created
May 26, 2018 21:25
-
-
Save abuslah/1a2f7652bba99a8cd7340c7552662562 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is the id of the form | |
$("#idForm").submit(function(e) { | |
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. | |
} | |
}); | |
e.preventDefault(); // 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