title: Ajax calls with JSONP doesn't work. Callback not provided
body: <p>I am trying to make a api call like this:</p>
  
  <pre><code> var url = 'http://[api link]?callback=?';
  
  $.ajax({
      type: 'GET',
      url: url,
      async: true,
      xhrFields: {
          withCredentials: true
      },
      jsonpCallback: 'jsonCallback',
      contentType: "application/json",
      dataType: 'jsonp',
      success: function(json) {
          console.dir(json.sites);
      },
      error: function(e) {
          console.log(e.message);
      }
  });
  </code></pre>
  
  <p>but in the browser it always shows in this format: <img src="https://i.stack.imgur.com/dbzsB.png" alt="Error Image"></p>
  
  <p>And in fiddler I get this following error:</p>
  
  <pre><code>[InvalidOperationException: A callback parameter was not provided in the request URI.]
  WebApiContrib.Formatting.Jsonp.JsonpMediaTypeFormatter.GetPerRequestFormatterInstance(Type type, HttpRequestMessage request, MediaTypeHeaderValue mediaType) + 320
  System.Net.Http.Formatting.DefaultContentNegotiator.Negotiate(Type type, HttpRequestMessage request, IEnumerable` 1 formatters) + 199
  System.Web.Http.Results.NegotiatedContentResult` 1.Execute(HttpStatusCode statusCode, T content, IContentNegotiator contentNegotiator, HttpRequestMessage request, IEnumerable` 1 formatters) + 103
  System.Net.Http.HttpRequestMessageExtensions.CreateResponse(HttpRequestMessage request, HttpStatusCode statusCode, T value, HttpConfiguration configuration) + 235
  System.Net.Http.HttpRequestMessageExtensions.CreateErrorResponse(HttpRequestMessage request, HttpStatusCode statusCode, Func` 2 errorCreator) + 298
  System.Web.Http.ExceptionHandling.DefaultExceptionHandler.Handle(ExceptionHandlerContext context) + 152
  System.Web.Http.ExceptionHandling.DefaultExceptionHandler.HandleAsync(ExceptionHandlerContext context, CancellationToken cancellationToken) + 12
  System.Web.Http.ExceptionHandling. &amp; lt;
  HandleAsyncCore &amp; gt;
  d__0.MoveNext() + 136
  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) + 144
  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) + 84
  System.Runtime.CompilerServices.TaskAwaiter` 1.GetResult() + 49
  System.Web.Http. &amp; lt;
  SendAsync &amp; gt;
  d__0.MoveNext() + 1584
  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) + 144
  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) + 84
  System.Runtime.CompilerServices.TaskAwaiter` 1.GetResult() + 49
  System.Web.Http.WebHost. &amp; lt;
  ProcessRequestAsyncCore &amp; gt;
  d__0.MoveNext() + 624
  System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) + 144
  System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) + 84
  System.Web.TaskAsyncHelper.EndTask(IAsyncResult ar) + 98
  System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() + 606
  System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean &amp; amp; completedSynchronously) + 288
  </code></pre>
  
  <p>In the.js file where the call is made, I have defined a
  function like this:</p>
  
  <pre><code>jsonCallback = function(data) {
  
  }
  </code></pre>
  
  <p>What am I doing wrong here?</p>
  
  <p>EDIT:</p>
  
  <p>Screen Shot of ajax error:
  <img src="https://i.stack.imgur.com/QnevO.png" alt="enter image description here"></p>
  
  <p>EDIT:</p>
  
  <p>WebapiConfig.cs        </p>
  
  <pre><code>var jsonFormatter = config.Formatters.OfType&lt;JsonMediaTypeFormatter&gt;().FirstOrDefault();
          jsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
  
      //add support for JSONP
      var formatter = new JsonpMediaTypeFormatter(jsonFormatter, "cb");
      config.Formatters.Insert(0, formatter);
  
      //Add Support CORS
      config.EnableCors();
  </code></pre>