title: How to call an Action method using ajax for a button click which is in partial view in MVC?
body: <p>I'm new to MVC. I got a situation where I need to pass a parameter from view to controller on the button click (the button is in partial view), which then renders another partial view in the same page.</p>
  
  <p>Steps followed:</p>
  
  <ol>
  <li>I used jquery button click event for the button of partial view. </li>
  <li>I made an ajax call to pass the parameters from my view to the controller.</li>
  </ol>
  
  <p>The following is my code:</p>
  
  <pre><code>$(document).on("click", "#btninPartialView", function(e){
      var data = $("txtinPartialView").val();
      $("#mainPageContainer").load("/Controller/Action", data, function(){
          $.ajax({
              //url: @Url.Action("Action", "Controller"),
              type: GET,
              data: {
                  id: data
              },
              success: function(){
              }
              error: function(){
              }
          })
      }    
  })
  </code></pre>
  
  <p>Problem:
  The problem is that, the data I'm received in the action method is <code>null</code>.</p>
  
  <p>Please let me know if I'm missing anything.</p>
  
  <p>Thanks in advance.</p>