How to clear DIV and add new content in while loop

2.4k Views Asked by At

I need to clear the <div> and insert new content I get from the database after each while loop in php. Can someone help me out with this problem? Also I need to sleep in the loop for about 10 sec.

I am using PHP for the while loop.

The general flow is like this -

while() {
  read from database;
  sleep;
  clear div;      ///I nead help here;
  Add content to div ///I need help here
}

Thanks

1

There are 1 best solutions below

5
Zoltan Toth On BEST ANSWER

to clear - $("div").empty();

to fill - $("div").html(your_ajax_response);