Created
November 9, 2011 17:23
-
-
Save albertein/1352164 to your computer and use it in GitHub Desktop.
Simple jQuery Ajax example.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>DEMO</title> | |
<script src="urlToJQuery"></script> | |
<script> | |
$(document).ready(function() { | |
$("#sumbit-button").click(function(){ | |
var name = $("#name").val(); | |
var age = $("#age").val(); | |
//Validate if needed | |
$.post("example.php", { name: name, age: age }, function(data) { | |
$("#results-pane").html(data).show("slow"); | |
}, "html"); | |
}); | |
}); | |
</script> | |
<style type="text/css"> | |
#results-pane { | |
display: none; | |
} | |
</style> | |
</head> | |
<body> | |
<form> | |
<input type="text" id="name" /> | |
<input type="text" id="age" /> | |
<input type="button" id="submit-button" /> | |
</form> | |
<div id="results-pane"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment