I’ve got a page that displays something like this:
“Who’s turn is it?
Jake”
Where “Jake” is populated with a jquery statement after an ajax query. something like:
$('#whosturnisit').append(result);
The problem is of course that it just adds the result each time it runs.
I’ve tried using .hide() and then doing .append(), but without good results.
I’ve also tried using
$('#whosturnisit').replaceWith(result);
But again, it does not seem to work correctly.
My desired result here is that this ajax query runs every X seconds, lets just say 30 seconds, and grabs the name of whoever’s turn it is, and displays that name.
Try emptying it first. And then if you want it to update every 30 seconds do something like this