0

In a Rails 2.3.5 app, I have:

observe_field :searchtype, :url => {:action=>'set_search_type'}, :with => "'search_type=' + value"

This no longer works in Rails3. What's the new way to implement this?

Thanks,

Joe

1 Answers1

3

JQuery analogue solutions:

$(document).ready(function() {
  $("#searchtype").bind("blur", function() {
    var url = '/set_search_type'; //your real url "??/set_search_type"
    var data = {search_type: $(this).val()}; // hash of input names and values for sending to server
    $.get(url, data, // make ajax request
     function(html) { // function to handle the response
    });
  });
});

How to convert this observe_field to jquery

Rails observe_field using jQuery

Community
  • 1
  • 1
Sector
  • 1,210
  • 12
  • 14