Search Autocomplete

Search with jQuery UI Autocomplete jsonp.

Using YouTube and Google Web xml at http://suggestqueries.google.com/complete/search?callback=?
No more ugly asp.net autocomplete for your search box, limited to your user quary's not Internet query's from Google or other search engines.

I have been playing around with this for a while and it came to me in my sleep last night and wow I got it working and so anyone could do this with the inline .js I have provided. First you need a Free Google CSE Search engine tailored for your Website.

With Autocompletions ON.

First I add my Themeroller jQuary ui adding my custom styles and scripts.

Then added the needed style to my HTML input.

ui-autocomplete-input

Addthis class the <div> surrounding my input and hidden inputs as below.

ui-widget

Two hidden inputs are needed, one with your Google CSE search engine ID and a UTF-8 input.

<input type="hidden" name="cx" value="013588495759638373148:g116y1r0c-a" />
<input type="hidden" name="ie" value="UTF-8" />

Make sure you Search input has both a id="cse-search-box", and a name="q". With autocomplete="off", which turns off your Browsers autocomplete, letting jQuary autocomplete can take over the job.

The code for my Search.SearchForm.cshtml in Themes\Views\Parts folder

 

Search.SearchForm.cshtml

 

The Magic script that makes this work

5 Comments

  • It's going to be ending of mine day, however before ending I am reading this great piece of writing to improve my experience.

    It's going to be ending of mine day, however before ending
    I am reading this great piece of writing to improve my experience.

  • youtube commenter

    Hello! I know this is somewhat off topic but I was wondering
    which blog platform are you using for this site? I'm getting sick and tired of
    Wordpress because I've had issues with hackers and I'm looking at alternatives for another platform.
    I would be fantastic if you could point me in the direction of a good platform.

    • donaldboulton

      I use Orchard CMS as a blogging platform and its secured like your WordPress site could be.
      See my post on spam http://donboulton.com/blogs/are-you-human-checker.
      And incorporate these in your site.
      WordPress is stable and a good platform, Orchard if you are not good at MVC Razor might be a significant change from PHP. Orchard is not as mature as WordPress and lacking the flexibility in modules and add-ons avalable.
      I love messing around with Orchard, but I like programing challenges

  • goo.gl

    Awesome post.

  • sortownia odpadów budowlanych kraków

    There's definitely a great deal to know about this topic.

    I really like all the points you've made.

Comments are Moderated, from, "(Spam-bots)", before they are posted.

 14232 Views