Right now my code looks like this:
<script type="text/javascript">
$(document).ready(function() {
$.ajaxSetup({
cache: false
});
var loadUrl = "<?php echo site_url("admin/get_uploads"); ?>";
$("#result").load(loadUrl);
var refreshId = setInterval(function() {
$("#result").load(loadUrl);
}, 1000);
});
</script>
The problem is that the gets refreshed every second, therefore if I have something selected within that div, after a second, the select resets to non-selected.
Is there a way to have jQuery to only bring in new data if it’s available and not refresh the every second?
A better solution would be to use a comet type approach, long polling is fairly easy to implement.