load search results into a div jquery and rails

Posted by odpogn on Stack Overflow See other posts from Stack Overflow or by odpogn
Published on 2011-01-04T06:50:45Z Indexed on 2011/01/04 6:53 UTC
Read the original article Hit count: 232

Filed under:
|
|
|
|

In my rails app I have a search bar where users can search other users. Currently when a User submits the search from, they're redirected to a "results" page. I want to load those results in a div on the same page.. I was able to do this with my websites navigation links, but I'm pretty new to jQuery and rails and can't figure this one out...

my jQuery corresponding to my navigation links:

$(function() {
    $('#links a').live('click', function() {
        $('#pages').load(this.href).fadeIn('slow');
        return false;
    });
});

my attempt to do the same with my search function...

$(function() {
    $('#search').submit(function() {
        $('#pages').load(this.href).fadeIn('slow');
    });
});

any help would be much appreciated~ along with some useful jQuery tutorials for a newbie!!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ruby-on-rails