Because the API doesn't use XMLHttpRequest, there's no real stop method. 
Generally, when doing an "as-you-type" sort of thing, I would recommend setting 
up a very slight (e.g., 250ms) timeout before actually running the search. That 
way you can clear the timeout if another key is pressed. If there are no other 
keys pressed, such a delay is generally not noticeable.

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
[email protected]

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

On May 17, 2010, at 3:11 AM, jimmy wrote:

> Hey Peeps
> 
> I was wondering if it was possible to cancel an ongoing webSearch ?
> 
> webSearch = new google.search.WebSearch();
> 
> Im doing a simple searchbar, with ajax "search as you write", but if
> the users deletes all in the searchbar it would still search the last
> query.
> 
> I usually do this with
> 
> var xhr;
> function something() {
>    xhr.stop();
>    xhr = $.get ...
> 
> in jQuery.
> 
> How do do this with the Google AJAX API ?
> 
> // Jimmy
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Google AJAX APIs" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-ajax-search-api?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-ajax-search-api?hl=en.

Reply via email to