<script type="text/javascript">
$(document).ready(function(){
$('#button').click(function () {
$.ajax({
type: 'post',
data: {'var': 'val' }
});
});
});
</script>
<?php
echo $_POST['var'];
?>