title: Jquery Ajax POST request with parameters in Rails (Ruby on Rails)
body: <p>I am trying to make ajax post request in rails application. But i am getting error in response.</p>
  
  <p>Rails code:-</p>
  
  <pre><code>def search_exams(myparam1 , myparam2)
     json_data = {:aaData=&gt; [["abc","xyz","lmnop"],["sdf","adsdf","sadfsd"],["sdf","adsdf","sadfsd"]]}.to_json
     respond_to do |format|
       format.json { render :json =&gt; json_data }
     end
  end
  </code></pre>
  
  <p>Script Code:-</p>
  
  <pre><code>&lt;%= javascript_tag "window._token = '#{form_authenticity_token}'" %&gt;
  
  
  &lt;script&gt;
  $.ajax({
          url:'/home/search_exams',
          type:'POST',
          dataType:'json',
          data:{
              myparam1: "First Param value",
              myparam2: "Second param value",
              authenticity_token: window._token
          },
          success:function(data){
              debugger;
          },
          error:function(data){
              debugger;
          }
      });
    &lt;/script&gt;
  </code></pre>
  
  <p>I am getting this error:-</p>
  
  <p>"ArgumentError in HomeController#search_exams wrong number of arguments (0 for 2) Rails.root: C:/Users/........"</p>