Search Results

Search found 1 results on 1 pages for 'blackpond'.

Page 1/1 | 1 

  • JQuery + Rails + Select Menu

    - by blackpond
    I want to have a select menu to change a field on a Customer dynamically, I've never used Jquery with a select menu, and I'm having problems. The code: <% form_for @customer , :url = { :action = "update" }, :html ={:class = "ajax_form"} do |f| % Pricing: <%= select :customer, :pricing, Customer::PRICING, {}, :onchange = "$('this').closest('form').submit();" % Application.js: $(document).ready(function(){ $(".ajax_link").live("click",function(event){ //take div class = ajax_link and call this funciton when clicked. event.preventDefault(); // cancels http request $.post($(this).attr("href"), null, null, "script"); return false; }); ajaxFormSubmitHooks(); }); function ajaxFormSubmitHooks(){ $(".ajax_form").submit(function(event){ event.preventDefault(); // cancels http request $.post($(this).attr("action"), $(this).serializeArray(), null, "script"); return false; }); }

    Read the article

1