title: How to use ajax send data to controller in ruby on rails
body: <p>i am new developer in ROR.i use ajax with event change to send data from select_tag in show.html.erb into controller in def show ... end . i try to send data but my script not work.below is my script : </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $('#cbo').change(function() {
         $.ajax({
          url: "/product_details/show",
          type: "POST",
          data: {"cbo_id" : $('#cbo').val()},
          dataType: "html",
          success: function(data) {
            alert('successfully');
          }
        });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>in product_details/show.html.erb</p>
  
  <pre><code>&lt;%= form_tag(product_detail_path, :method =&gt; "post") do %&gt;
    &lt;%= select_tag "categories", options_from_collection_for_select(Category.all, :id,     :category_name),:id =&gt; 'cbo' %&gt;
  &lt;% end %&gt;
  
  def show
    @getcbo = params[:cbo_id]
  end
  </code></pre>
  
  <p>I think maybe wrong about url: "/product_details/show" .So how can i use url for send data to def show ... end in controller? .please help me !  </p>