Hi guys, i've been looking for some "light" for  this problem, but
honestly i dont know where i can find some information about this.

I'm using ajax for a live search, so everything works fine.

View:


<form id="live-search-form" method="get" action="<%= search_path %>">
  <input id="big-search-box" name="q" type="text"  autocomplete="off"/>
</form>

<div id="live-search-results"></div>


Controller:

  def live_search

    @lafnuevas = Lafnueva.search params[:q], :page => params[:page],
:per_page => 1000
    render :partial => 'filtrado'

  end


Application.js:


 $(document).ready(function(){
  $('#big-search-box').bind('keyup',function() {

    var form = $('#live-search-form'); // grab the form wrapping the
search bar.
      var url = '/lafnuevas/live_search'; // live_search action.
    var formData = form.serialize(); // grab the data in the form


    $.get(url, formData, function(html) { // perform an AJAX get
       $('#live-search-results').html(html); // replace the "results"
div with the results

      });

  });

});


But when i display the information i get the extra content that is the
result of my query:

[#<Lafnueva id: 80091, captura: "71", fechac: "1997-02-04 00:00:00",
titulo1: "L'ATLAS CURIEUX OU LE MONDE ... / DRESSé ET DEDIé..."

And after that i have my partial without problem.

Somebody can help me for dont display the extra content i've been
looking for the problem and perhaps everything for solve the problem is
in this line in application.js :
       $('#live-search-results').html(html); // replace the "results"
div with the results


but the other options dont work fine (val,text), and when i inspect the
element the extra content appear between  quotes (").

Thanks in advance.

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/8a5e188c1391f7b2bb58036307e2cbee%40ruby-forum.com?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to