lundi 28 mars 2016

Accessing input.val() at client side in order to render partial with parameters

I have an input with id "searcha", trying to perform a live search

    <input type="input" id="searcha" placeholder="Search">

I can't find a way to pass the $('#searcha').val() to render on keyup()

 $('#searcha').keyup(function(){
 $('#index-table').html('<%= j (render index, :locals => query: $('searcha').val() ) %>')
  })

and How should I be passing params[:query] to the controller ?

Aucun commentaire:

Enregistrer un commentaire