When i click next butoon of index.php, jquery performs its work, alert and loads the content of check.php in div 'result'.
But, Now when i again click on next button nothing happens, no alert, why ? I want that-alert should be displayed again and jquery should be load check.php as done on first click. Here is my code:
This is index.php
<?php
session_start();
?>
<html>
<head>
<script src="js/jquery-1.3.2.js"></script>
<script>
$(document).ready(function()
{
$("button[name='next']").click(function() //when button clicked
{
var count= $('button[name=next]').val(); //value of button
alert('button clicked');
$.ajax(
{url:"check.php",type: "POST",data: 'count='+ count,success:function(result)
{
$("#result").html(result);
}
});
});
});
</script>
</head>
<body>
<?php $_SESSION['count']='0'; ?>
<div id="result">
<button name="next" value="<?php echo ($_SESSION['count']);?>">Next</button>
</div>
</body>
</html>
This is check.php
<?php
session_start();
$_SESSION['count']=$_POST['count']+1;
?>
<button name="next" value="<?php echo ($_SESSION['count']);?>">Next</button>