Just to help get the ball rolling a bit, this is some code I got off the internet and have attempted to adapt it. However, with just about everything I try, it totally failed. 
Code:
<div id="battle"></div>
<script>
// jQuery fires this function when the DOM is loaded and ready to use/manipulate
$(document).ready(
function(){
(data)
// via an HTTP GET action, and sets a function (callback) to run when it receives
// a message back from the server
$.ajax({
url : "battlestatus.php",
success : function (data) {
yourTurn = html(data);
alert(yourTurn);
doReturnAction(yourTurn);
}
});
}
);
function doReturnAction(data){
if( data == "yes" ){
$('#battle').html( 'HAHA! Your Turn! GET HIM!<br><form><input name="attack" type="button" value="ATTACK!" /></form>' );
}
else{
$('#battle').html( 'Please wait while you Enemy tries to kill you...' );
}
}
</script>
What I want this script to do:- Every few secconds check what output the php page is giving
- display some HTML in the specified DIV if it outputs "yes"
- and if it is outputting "no" display some different HTML
I hope this clarifies what I need done
EDIT: jQuery is included from an included php file containing page headers. I only displayed the piece I needed help with
Bookmarks