Hi,
I'm building a battleship game that has multiple sessions over an apache server.
It's a server/client containing servlets & jsp's.
Let's say i have a jsp page that shows all the boards, for each session i want this page to be refreshed as soon another player makes a move.
Is there a way to do this with ajax?
i tried this function and it doesn't seem to work when gamestatus attribute is changed.
$(document).ready(function(){window.setInterval(checkPlayerStatus,500);})
function checkPlayerStatus(){
$.ajax ({
data:"ajaxrequest=gamestatus",
url:"/Battleship/playGame.jsp",
timeout: 2000,
error:function(){},
success:function(r){
if(r=="moveMade"){
window.location=window.location;
}
}
});
}
this code seemed to work with a servlet containing an html response.
Could it be there's a problem when using it with jsp?