php - Why query is slow using ajax? -
i made php class search database methods. i.e like
, full text
, ...
i did test on huge database. search speed great, started use script in page.
i decided use ajax speed stuff...
this ajax code :
$.ajax({ type: "post", data: publisher + '&blur=true', url:"server/advance2.php", ifmodified: true, /* tested , without */ cache: true, /* tested , without */ statuscode: { 404: function() { $('#target').html('<h4 class="col-md-offset-4 col-md-3 textred textcenter farsi">error...</h4>'); }//404 },//statuscode beforesend: function() { $('#target').html('<img src="e995a9c2864f.gif" class="col-md-offset-4 col-md-3" alt="we searching, please wait"/>'); }, success: function(result) { $('#target').html(result) } });//ajax request after blur
but search speed decreased.
would tell me why it's happening, , how can fix it?
a couple of quick debugging ideas:
1) open browser debugger, started f12, make sure the majority of time of response waiting on web server (vs rendering, etc.).
2) on server side, find db query log , see how long query taking. noted in other answers, there number of moving parts here. need step step , find 1 that's taking longer expected.
Comments
Post a Comment