views:

36

answers:

1

I'm a rails beginner and am curious how the live search on http://jobs.37signals.com is implemented?

I can understand the background but not the front end.

what I understand:

  • after certain # of characters have been typed, a request is made to backend with the phrase as search term
  • do a database search where job description like '%_phrase_%'
  • how to bring data back?

Using firebug on the site it seems that the whole result is returned as a javascript that contains html tags...

I'm curious as to how this is done?

I was not able to find any tutorials/examples that would show how this whole process is done.

Any direction?

+2  A: 

The key word is AJAX.

To start off, you probably want to look at jQuery AJAX functions or a Javascript framework of your choice.

AJAX does things this way:

  1. Page is loaded normally
  2. Your Javascript makes AJAX call back to server, Page does not refresh/reload
  3. Server sends response via AJAX call
  4. Your Javascript processes the response and give the appropriate output to the user.
thephpdeveloper