Functions list:

.ajax


Retrieve data asynchronously in the background


Description:
Z("").ajax({
	url: 'ajax.php'
	[, method: 'POST',
	data: 'a=hello&b=howAreYou',
	type: 'application/x-www-form-urlencoded',
	result: function(data){ alert(data); },
	error: function(data){ alert(data); }]
});
		

Example:
<div id="my_element">Previous content</div>

<script type="text/javascript">

// insert "New content" in above DIV
Z("").ajax({
	url: 'send_ajax.php',
	method: 'POST',
	data: 'page=2',
	result: function(data){ Z("#my_element").html(data); }
	error: function(data){ alert("an error occured!\n" + data) }
});

</script>
send_ajax.php
<?php

if(isset($_POST['page'])){
	if($_POST['page'] == '2')
	{
		print 'New content';
	}
}

?>