title: Calling a Web Api 2 Method using Ajax
body: <p>I have a Web Api 2 project which I used for a mobile project. I am trying to use the same api's for a web project but am unable to reach them using ajax. I've confirmed that my url is correct and I am able to hit the endpoint from an android project and from fiddler. Am I missing something is my ajax call? I always hit the error function, which returns 'undefined'. I can set a breakpoint in my webapi project and that endpoint is never being hit.</p>
  
  <pre><code>// GET: api/Trips
  public IQueryable&lt;Trip&gt; GetTrips()
  {
       return db.Trips.Include("Users");
  }
  </code></pre>
  
  <p>jquery</p>
  
  <pre><code>            $.ajax({
                  url: 'http://localhost:49669/api/Trips',
                  type: 'GET',
                  contentType: 'application/json;charset=utf-8',
                  success: function (data) {
                      alert("success!!");
  
                  },
                  error: function (x, y) {
                      alert(x.response);
                  }
              });
  </code></pre>