I have searched long and hard to find a solution to this problem to no avail.
here is the jquery. on the php side I'm just using a small string to detect headers and such.
(i know, i know "you should use $.post instead" I'm useing $.ajax beacuse it gives me a bit clearer idea of what is happening)
the issue I'm having is that while the ajax appears to activate every time, the php only responds the second time.
I.E. click(ajax send. no response), click(ajax send. response), click(ajax send. no response), click(ajax send. response) etc.
any help would be appreciated
here is the jquery. on the php side I'm just using a small string to detect headers and such.
Code:
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$("body").on("click", "button", function(){
$.ajax({
type: 'POST',
url: 'exec.php',
cache: false,
beforeSend:function(){
//loading image
$('#out').html('<div class="loading"><img src="loader.gif" alt="Loading..." /></div>');
},
success:function(data){
//output the data
$('#out').empty();
$('#out').html(data);
},
error:function(){
//failure
$('#out').html('<p class="error"><strong>Oops!</strong> Try again...</p>');
}
});
});
</script>
<div class="form">
<button>Play the Game</button>
the issue I'm having is that while the ajax appears to activate every time, the php only responds the second time.
I.E. click(ajax send. no response), click(ajax send. response), click(ajax send. no response), click(ajax send. response) etc.
any help would be appreciated
Last edited: