Jump to content

toxicious

Members
  • Posts

    55
  • Joined

  • Last visited

Posts posted by toxicious

  1. function instaSearch(acount, searchTerm){//Abort opened requests to speed it upif(runningRequest){  request.abort();}else{   //Show searchtip  $('#searchText').slideDown("200");}runningRequest=true;request = $.get('addonstable.php',{ search: encodeURIComponent(searchTerm) , count: acount},function(data){  $("#table").html(data);   //Remove searchtip  $('#searchText').stop(true);  $('#searchText').slideUp("200");  runningRequest=false;});}

    As you can see, no big changes. I am using an anonymous function with no name. Are you sure it needs to be named success?

  2. read the documentation. http://api.jquery.com/jQuery.get/ to make it async, you need to provide a callback function to be run when the request is completed, which is the function literal you are defining after you make the request.
    Yeah, realised now that I need to put the "remove code" for the searchtip there. But since I am providing that callback function, why does it still lag? Is there something else causing it maybe?
  3. I'm trying to implement insta-search on my webpage, and I have got it working.But there is one problem: it doesn't seem to be completely async. Here is the page with the search box: http://gaddons.tk Oh, and don't visit it in IE since it doesn't work at all in IE (the whole div turns white lol, have to make another thread about that).If you type something quite fast the site will either hang or some of the letters you typed won't get typed, the syndroms of sync requests. I am searching "onkeyup" using this javascript method:

    function instaSearch(acount, searchTerm){//Abort opened requests to speed it upif(runningRequest){  request.abort();} //Add searchtip - this doesn't seem to get added either, though if I add alerts before and after I can see it....$('#searchBox').after('<p id="searchText">Searching...</p>');runningRequest=true;request = $.get('addonstable.php',{ search: encodeURIComponent(searchTerm) , count: acount},function(data){  $("#table").html(data);  runningRequest=false;});//Remove searchtip$('#searchText').remove();}

    Any clue on how I can make it completely async?I know at least two pages that has a completely async search, Google and the Swedish site "prisjakt.nu", so it can't be a impossibility :)

×
×
  • Create New...