943,202 Members | Top Members by Rank

Ad:
  • Ruby Discussion Thread
  • Unsolved
  • Views: 525
  • Ruby RSS
Jul 28th, 2010
0

Ruby on Rails jQuery Visual Effect

Expand Post »
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

Ruby Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <title>Tutor</title>
  4. <%= javascript_include_tag :defaults %>
  5. </head>
  6. <body>
  7. <h1></h1>
  8. <%= form_remote_tag :url =>{ :action => :search_results }, :update => "results" %>
  9.  
  10.  
  11. <fieldset>
  12. <legend>Tutor Search.</legend>
  13. <label for="searchItField">Keyword Search.</label>
  14.  
  15. <input class="tfield" type="text" value="FIND YOUR TUTOR HERE" name="searchItField" id="searchItField" />
  16. <span id="Submit_search">
  17.  
  18. <span id="Submit_search_hover"><input type="submit" id="Submit" value="Search" /></span>
  19.  
  20. </span>
  21. </fieldset>
  22. </form>
  23.  
  24. <div id="results">
  25.  
  26. </div>
  27. </body>
  28. </html>

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

Ruby Syntax (Toggle Plain Text)
  1. <% for tutors in @tutors %>
  2. <%= tutors.first_name %> <br/>
  3. <% end %>

And finally here is my controller and actions.

Ruby Syntax (Toggle Plain Text)
  1. class TutorsController < ApplicationController
  2.  
  3. def search
  4. end
  5.  
  6. def search_results
  7. @tutors = Tutors.find_by_sql('SELECT * FROM tutors')
  8. end
  9.  
  10. 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
Last edited by alexgv14; Jul 28th, 2010 at 6:13 pm.
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
alexgv14 is offline Offline
49 posts
since Feb 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Ruby Forum Timeline: Rails Upgrade to 2.3.8 - Help
Next Thread in Ruby Forum Timeline: Obeserve_field





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC