web browser become slow or no response after several ajax calls
- by Patrick
I'm totally newbie to jquery and ajax, my recently project is to help the representatives (reps) to manage customer quotations online. I have a page which displays all the quotations in a big table.
I've managed to use ajax to fetch and display the quotations which associate to a particular rep after i click that rep's name. But the only problem is the speed of response. The first few clicks are ok and very smooth. But after several tries, the response become slow and I cant even scroll down the webpage, and later on the web browser craches....
Please have a look at my ajax code.
here it is:
<!-- AJAX FETCH QUOTES DATA + Tablesorter + FIXED TABLE HEADER-->
<script type="text/javascript">
//<![CDATA[
$(function(){
$("a.repID").click(function(){
$('div#loader').append("<p align='center'><img src='images/loadingbar2.gif' id='loading' /></p>");
var repID = $(this).attr("title");
$.ajax({
type:'POST',
url:'quote_info.php',
data:'repID=' + repID,
cache: false,
success:function(data)
{
$("#container").html('<div id="content">' + data + '</div>');
$("#loading").fadeOut(500, function() {$(this).remove();});
$("#sortme").tablesorter();
$('.tbl').fixedtableheader();
}
});
return false;
});
});
</script>
<!-- AJAX FETCH QUOTES DATA + Tablesorter + FIXED TABLE HEADER-->