Another thing you could add is to only start a search after two or three characters have been entered. That, combined with Logic Ali’s suggestion above should significantly reduce the number of requests.
The misplaced bracket? Yeah I saw that, but even with the correction I get an error which throws back to the original script… it looks like some kind of incompatibility between your script and my implementation of Immerse’s suggestion to wait until at least 3 characters were typed.
Message: ‘length’ is null or not an object
I don’t get this error without your delay code in place but its referencing the following line in the main script which makes the Ajax call.:
That seems to implement the delay but messes up the Ajax call, I get no matches on my Ajax query where before I had them. It also seems to cause the Ajax call to happen instantly after 1 second in Internet Explorer, even if no keypress is made.
Sorry to bounce this thread, but I have another query.
I know we spent a lot of time on this example reducing the number of AJAX calls so there was no more than 1 per second and only after at least 3 characters had been typed into the search box.
But I now want to hotlink to the page that makes this AJAX call with a pre-defined search parameter in the QueryString, so I need to the script to make the Ajax call as the page first loads (but still only if the search parameter contains at least 3 characters) as well as when there is a change to the search textbox.