title: Make an AJAX request using $.ajax in MVC 4
body: <p>I am trying to make an AJAX request using $.ajax in MVC 4 with Razor. I'm not sure how to implement it. </p>
  
  <p>Using <a href="http://www.youtube.com/watch?v=gLiWQkqUoVM" rel="nofollow noreferrer">this video</a> I was able to successfully make a link-driven call that returned data, but I can't seem to do the same thing from inside a jquery function. I can't seem to find any basic examples of how to do this.
  This is what I am working with:</p>
  
  <p><strong>HomeController.cs</strong></p>
  
  <pre><code>        public string test(){
               return "It works";
          }
  </code></pre>
  
  <p><strong>View.cshtml</strong></p>
  
  <pre><code>function inventory(dealerID) {
      $.ajax({
          url: '@Url.Action("HomeController","test")',
          data: {dealerID: dealerID},
          type: 'POST',
          success: function(data) {
              process(data);
          }
      });
  }
  </code></pre>