How to remove div completely in jQuery?

AJAX/JQUERY update div?

  • How can I update a div using AJAX/JQUERY? I ask this because my div re-loads every 10 seconds, and in the response it has checkboxes. When it reloads, the checked ones disappear, meaning they aren't checked anymore. Now this could be a pain to try to check a lot of them, then have them disappear after 10 seconds. How could I make it so that it compares the response and if it is different only insert the new data, not load the whole thing? Currently I have: <script src="http://code.jquery.com/jquery-lates… <script> $(document).ready(function() { $("#table").load("response.php"); var refreshId = setInterval(function() { $("#table").load('response.php'); }, 9000); $.ajaxSetup({ cache: false }); }); </script>

  • Answer:

    Just grab your set of checked boxes before you call the refresh. Then after the refresh, set them to checked again. So inside your setInterval function, you could do something like this... $ch = $('#table').find('input:checked'); $('#table').load('response.php'); $ch.attr('checked', 'checked'); // or for jQuery 1.6+ // $ch.prop('checked', true);

Kyle at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

9000= 9 second <script src="http://code.jquery.com/jquery-lates… <script> $(document).ready(function() { $("#table").load("response.php"); var refreshId = setInterval(function() { $("#table").load('response.php'); }, 0); $.ajaxSetup({ cache: false }); }); </script> now you try

Priyanka

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.