title: MVC Controller Method Parameter Always Null
body: <p>My javascript function is calling my MVC 4 controller, but the parameter is always null. This seems to be a common problem, and I've tried a few things I've researched, but nothing is working. Any idea why it's always null?</p>
  
  <p>My javascript GetEntries() function correctly creates an alert that shows the value:</p>
  
  <pre><code>function GetEntries(firstLetter) {
      alert(firstLetter);
      $.post('/Home/GetEntries',
             firstLetter,
             EntriesReceived());
  }
  </code></pre>
  
  <p>My controller method breakpoint gets hit:</p>
  
  <pre><code>public void GetEntries(string firstLetter)
  {
      Debug.WriteLine(firstLetter);
  }
  </code></pre>
  
  <p>However, firstLetter is always null. I'm not sure what to do.</p>
  
  <p><strong>Failed attempts:</strong></p>
  
  <p><strong>I tried posting using JSON.stringify.</strong></p>
  
  <pre><code>function GetEntries(firstLetter) {
      alert(firstLetter);
      var firstLetterAsJson = JSON.stringify(firstLetter);
      $.post('/Home/GetEntries',
             { jsonData: firstLetterAsJson },
              EntriesReceived());
  }
  </code></pre>
  
  <p><strong>I tried adding the HttpPost attribute to my controller:</strong></p>
  
  <pre><code>[HttpPost]
  public void GetEntries(string firstLetter)
  {
      Debug.WriteLine(firstLetter);
  }
  </code></pre>
  
  <p><strong>I tried changing the parameter name to "id" to match my route mapping:</strong></p>
  
  <pre><code>[HttpPost]
  public void GetEntries(string id)
  {
      Debug.WriteLine(id);
  }
  </code></pre>