Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 69129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:31:30+00:00 2026-05-10T19:31:30+00:00

I have a page where search resuts are shown both in a grid and

  • 0

I have a page where search resuts are shown both in a grid and on a map (using KML generated on the fly, overlaid on an embedded Google map). I’ve wired this up to work as the user types; here’s the skeleton of my code, which works:

$(function() {     // Wire up search textbox     $('input.Search').bind('keyup', update); });  update = function(e) {     // Get text from search box     // Pass to web method and bind to concessions grid     $.ajax({           ...         success: function(msg) {             displayResults(msg, filterParams);         },     });  }  displayResults = function(msg, filterParams) {         // Databind results grid using jTemplates         // Show results on map: Pass parameters to KML generator and overlay on map } 

Depending on the search, there may be hundreds of results; and so the work that happens in displayResults is processor-intensive both on the server (querying the database, building and simplifying the KML on the fly) and on the client (databinding the results grid, overlaying big KML files on the map).

I like the immediacy of getting progressively narrower results as I type, but I’d like to minimize the number of times this refreshes. What’s the simplest way to introduce an N-second delay after the user stops typing, before running the update function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T19:31:30+00:00Added an answer on May 10, 2026 at 7:31 pm

    Instead of calling update() directly, call a wrapper that checks to see if there are any pending delayed updates:

    $('input.Search').bind('keyup', delayedUpdate);  function delayedUpdate() {     if (updatePending) {         clearTimeout(updatePending);     }      updatePending = setTimeout(update, 250); }  function update() {     updatePending = false;      //$.ajax(... } 

    You should also probably add:

    $('input.Search').bind('blur', update); 

    This will do an immediate update when the user leaves the field. But make sure you also add handling for the case where the user leaves the field while there’s a pending delayed update (cancel the delayed update first).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a google maps on my page with a search pane I built
I have the following problem. My sitemap's content is shown in GOOGLE search results.
Here's my new question: On a search results page we have 12 products shown.
I have this page, shown below. In the ASCX file, the data is generated
I'm using django and have a page of search results that I want to
I have a page that displays search results and has a DOM like the
I have a search page that if there is results in the list it
I have xpath page.search(//table[@class='campaign']//table) which returns two tables. I need to choose only first
I have a search page which uses a simple ajax request to get new
I have a search page like <div class=> <input id=search-input type=text class=input-medium search-query span4>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.