<html>
<head>
	//devi includere jquery
	
	
	
	<script type="text/javascript">
		function getPost(limit)
		{
		 $.ajax({
			type: "POST",
			url: "getPost.php",
			data: { limit: limit,
			cache: false,
			success: function(response)
				{
					if(response == 'ERRORE' || response == null)
					  {
						alert('cavolo!');
					  }
					else
					{
						$('#post').append(response);
						$('#limit').val(limit += 5);
					}
				}
		 })
		 .fail( function() {
			alert('errore');
		 });
		}
	</script>
</head>
<body onload="getPost($('#limit').val());">
	 
	 <div id="post">
		<input type="hidden" id="limit" name="limit" value="5" />
	 </div>
<input type="button" onclick="getPost($('#limit').val());" />
</body>
</html>