alexgv14 0 Light Poster

I am working on a search function on RoR that basically just has a cool visual effect when a user clicks the search button.

Here is the code in my view for search.rhtml

<html>
  <head>
    <title>Tutor</title>
    <%= javascript_include_tag :defaults %>
  </head>
  <body>
    <h1></h1>
        <%= form_remote_tag :url =>{ :action => :search_results }, :update => "results"  %>


                    <fieldset>
                        <legend>Tutor Search.</legend>
                        <label for="searchItField">Keyword Search.</label>

                        <input class="tfield" type="text" value="FIND YOUR TUTOR HERE" name="searchItField" id="searchItField" />
                        <span id="Submit_search">

                            <span id="Submit_search_hover"><input type="submit" id="Submit" value="Search" /></span>

                        </span>
                    </fieldset>
                </form>

    <div id="results">

    </div>
  </body>
</html>

Here is the search_results.rhtml which is what gets displayed in the results div in search.rhtml

<% for tutors in @tutors %>
        <%= tutors.first_name %> <br/>
    <% end %>

And finally here is my controller and actions.

class TutorsController < ApplicationController

  def search
  end

  def search_results
     @tutors = Tutors.find_by_sql('SELECT * FROM tutors')
  end

end

MY QUESTION IS. How do I create an effect on my ajax request? Which updates on the <div id="results"> . I am using jrails. Baiscally, I want to create this effect. http://keyonary.com/#/paste

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.