title: Use jQuery.getJson to get Web API
body: <p>I'm a beginner of ASP.NET Web API.<br />
  Fail to use <code>jQuery.getJson()</code> to get <code>ASP.NET Web API</code></p>
  <blockquote>
  <p>this failed:</p>
  </blockquote>
  <pre><code>var url = &quot;http://localhost:56110/api/Values&quot;;
  $.getJSON(url, function (data) {
      $(&quot;#locMsg&quot;).text(&quot;success&quot;+data);
  });`
  </code></pre>
  <blockquote>
  <p>I though it is because of cross-domain request, but this succeeded:</p>
  </blockquote>
  <pre><code>var url = &quot;http://api.flickr.com/services/feeds/photos_public.gne?tags=dog&amp;tagmode=any&amp;format=json&amp;jsoncallback=?&quot;;
  $.getJSON(url, function (data) {
      $(&quot;#locMsg&quot;).text(&quot;success&quot;);
  });
  </code></pre>
  <blockquote>
  <p>then I tried to add &quot;jsoncallback=?&quot; but also failed:</p>
  </blockquote>
  <pre><code>var url = &quot;http://localhost:56110/api/Values?jsoncallback=?&quot;;
  $.getJSON(url, function (data) {
      $(&quot;#locMsg&quot;).text(&quot;success&quot;+data);
  });
  </code></pre>
  <blockquote>
  <p>ValuesController:</p>
  </blockquote>
  <pre><code>namespace WebApplication1.Controllers{
  public class ValuesController : ApiController
  {
      // GET api/values
      public IEnumerable&lt;string&gt; Get()
      {
          return new string[] { &quot;value1&quot;, &quot;value2&quot; };
      }`
  
      `// GET api/values/5
      public string Get(int id)
      {
          return &quot;value&quot;;
      }
  
      // POST api/values
      public void Post([FromBody]string value)
      {
      }
  
      // PUT api/values/5
      public void Put(int id, [FromBody]string value)
      {
      }
  
      // DELETE api/values/5
      public void Delete(int id)
      {
      }
  }
  </code></pre>
  <p>}
  }</p>