title: how to call controller action in ajax url
body: <p>I want to call the controller method in ajax url to dynamically populate the dropdown based on value from another dropdown. The value I am getting is string, when I call this method using ajax url it always refers to 'show' method. My ajax call</p>
  
  <pre><code>$('#users').change(function() {
    url: '/users/update_groups',
    data: {name: $(this).val()},
    success: function (data) {
      alert(data);
    }
  });
  </code></pre>
  
  <p>In my users_controller.rb</p>
  
  <pre><code>def update_groups user_name
    # returns list of groups
  end
  </code></pre>
  
  <p>How to call this method using ajax url?</p>