Wednesday, June 14, 2006

Get Google Ajax Search For Your Site UPDATE

If you read my recent post, How to Get Google AJAX Search For Your Site, and used it to implement the Google Ajax Search control on your blog or website, this post is for you.

When I replaced the old Google Search box with the newer Google Ajax Search for my blog, I quickly realized that there was no way to clear the search results from the screen. That's why I wrote the function "searchControlClear()" that I described previously. Since writing that post, Google has included the clear functionality natively into the search control, so some changes could be made to make things work more smoothly.

These are the changes I made to use Google's built in function instead of my own. In your javascript, you need to make two changes: one at the beginning and one at the end. First, move this line of code:
var searchControl = new GSearchControl();
to the line above this line of code:
function onLoad()
So the beginning of your javascript should look like this:
//<![CDATA[
var searchControl = new GSearchControl();
function onLoad()
{
function MyBlogSearch()
{
.
.
.
The second change you need to make is at the end of your javascript code. Inside the searchControlClear() function, replace everything with this:
searchControl.clearAllResults();
So your function should look like this:
function searchControlClear()
{
searchControl.clearAllResults();
}
Try this on for size!

Labels:

26 Comments:

Blogger Forever Canadian said...

Hey there,

I found your blog in a random search and checked it out. It's really interesting, but when I took a look at your resume it looked trash. Not what you have on there, but the way you've but it together. I hope that that isn't the resume you use when looking for a job. If it is email me and I'll fix it up for you (ciller_be@yahoo.com) for free.

6/17/2006 12:23:00 PM  
Blogger S7 Ghost said...

Really cool blog, some of the posts are very interesting.

6/17/2006 05:42:00 PM  
Blogger Yasser said...

If you were to choose the most successful and innovative company in the world would it be Google?

6/17/2006 09:32:00 PM  
Anonymous venice said...

wow nice post... you should share this blog of yours to my peeps at wealthymen dotcom.. im pretty sure they will enjoy this as much as i do!

6/18/2006 11:46:00 AM  
Blogger Walking Wounded said...

Your information was excellent but I seem to be having a problem. No search box nor "clear" search link appears on my page. I used the modified codes which were updated after Google made the change to their search function.

If you'd like I could send you a copy of my template so you can take a peek and see where I might have messed up?

Let me know, cause I think this functionality would be great for my sites.

Thank you,

Dave

6/18/2006 03:39:00 PM  
Blogger talksmart said...

Hello..really curuios of your site being featured as "blog of note" in blogger. Great job!

6/18/2006 10:15:00 PM  
Blogger beatnik said...

www.loosechange911.com
No matter if you've already seen it, SHARE IT!

6/19/2006 01:03:00 PM  
Blogger Shaun said...

That is awesome!

** Shaun **
My awesome blog: ohpunk.blogspot.com

-

6/20/2006 12:27:00 AM  
Blogger EmailHosting.com said...

Thank you so much for the Google Ajax search. That's a great addition to any website.

6/20/2006 09:15:00 PM  
Blogger The Analyzer said...

I may have to try it. Sounds interesting.

6/22/2006 09:23:00 AM  
Blogger tђє เภŦค๓๏ยร ؟؟ said...

Hey buddy I have a question, which I dunno if you've already answered because I'm too lazy to check but get back to me on this... how the fuck do you put a navigation (side)bar on your blog man do you use some sort of Javascript or what? Comment on my blog or e-mail me: crazy_encore2005@hotmail.com! Man I fuckin' need to know. If you wanna know my blog name it's called The Everything Blog. Please comment on it and get back to me, and everyone reading this please check it out! Thanks dudes!!

6/22/2006 07:15:00 PM  
Blogger luella said...

ver cool post, thanks

6/23/2006 01:04:00 PM  
Blogger Curta a vida pq ela eh mto curta said...

oi, seu blog esta muito legal, quando der passa lá no nosso....
valeu....

6/23/2006 01:39:00 PM  
Blogger Juna Duncan said...

Found your blog on "blogs of note" too. I wish understood what you are talking about because I could use more hits on my website as well.

Thanks anyway.

6/23/2006 02:30:00 PM  
Blogger Tyler said...

Hello, I have been trying to work out how to make my page, have another column down the left hand side just as yours does, here is my blog page. praguecentral.blogspot.com. can you tell me how? thank you

6/25/2006 02:02:00 AM  
Blogger GS said...

you have a good blog.

Link exchange ?

6/25/2006 12:52:00 PM  
Anonymous Reggie said...

Great! I will try to implement this on my site.

6/25/2006 06:22:00 PM  
Anonymous Deke said...

Dude, this is GOOD STUFF. I think I'll use it on my website...

Hey, check out this cool blog I found. It's really great sarcastic humor.

http://eventuallypublished.blog.com

6/26/2006 06:02:00 AM  
Blogger SexyNinjaMonkey said...

I've already used Google's Ajax search on my site. It's an excellent little search dealie. I like how you've changed it to float in the corner... Great idea. Wish i'd thought of it.

6/26/2006 06:03:00 AM  
Blogger darkman said...

Check out my blog,comments welcome.

6/26/2006 07:58:00 AM  
Blogger Ghosty said...

This is way cool, and way useful. I have a couple of blogs with months of entries; I'm going to test this out to see if it works well enough to allow visitors to search waaaay back in history. Thanks!

7/14/2006 01:20:00 PM  
Blogger Pig Leg Pete said...

Shouldn't there be an additional div close tag on the end?
I see you open a div for the SearchControlWrapper and one for the SearchControl, but only one close.

I can't get any search box to show up on my site, so trying to figure out why

7/15/2006 12:39:00 AM  
Blogger urscharminggal said...

I have put up the AJAX search, but somehow it does not return any results. The url is
http://urscharmingal.blogspot.com/
Thanks

7/20/2006 04:29:00 PM  
Blogger CJ said...

@urscharminggal

It looks to be working fine for me! :-)

7/20/2006 06:56:00 PM  
Blogger urscharminggal said...

yes, and thanks for visiting my blog.

7/21/2006 12:29:00 PM  
Anonymous cigara said...

My name is Veronika.
I saw your blog and I found cognitive.
So, what do you think about our collaboration?
I believe it would be great to exchange blogs!
My blog is: http://cigarettestyle.blogsome.com
Wait for your reply.
Have a nice day.
Veronika.

4/24/2007 07:58:00 AM  

Post a Comment

<< Home