Username:   Password:  

jQuery Ajax example

$(document).ready(function() {
	$("#link").click(function() {
		$("#output").load(
						"site.php",
						{ id: 4, name: "test" },
						function() {
							alert("I was clicked");
						}
		);
	});
});

Loads page "site.php" with passed post variables "id" & "name" and posts the output to div "output", when DOM element with id "link" is clicked

Tags

jQuery Javascript Ajax