This was the first post I found and was the most helpful but it still left a a few questions and I found a few problems with some of the answers, while I was able to make it work because of all the answers, I wanted to add what I learned because it seem to be high in the search returns.
I installed https://www.nuget.org/packages/WebApiContrib.Formatting.Jsonp and was able to get it to work after I added
GlobalConfiguration.Configuration.Formatters.Insert(0, new JsonpMediaTypeFormatter(new JsonMediaTypeFormatter()));
to my Global.asax on application startas Alex Wheat and mbudnik answered, it caused the CORS to stop working on the other parts of my API that have all ready been implemented.
I now have it all working properly and figured out a few things from the package developer's github.
after installing the nuget package,
Add the following to your Global.asax file
GlobalConfiguration.Configuration.AddJsonpFormatter();
then if you call the service using the below Jquery, just replace the url with your url and you can see the results in you console. I also recommend getting Fiddler Web Debugger installed because it will help you troubleshoot.
$.ajax({
url: 'http://jsfiddle.net/echo/jsonp/',
type: 'GET',
contentType: 'text/javascript',
crossDomain: true,
success: function(data) {
console.log(data);
},
error: function(jqXHR,status,error) {
console.log(error);
}
});
The contentType: 'text/javascript' is important. This is what tells the web api to use the Jsonp Formatter.
Do not include a dataType of 'jsonp' - Example below
...type: 'GET',
dataType: 'jsonp',
crossDomain: true,...
this will cause the web api to use the JsonMediaTypeFormatter and you will get the "jQueryrandomfunctionstring was not called parsererror" error. I know this from personal trial and error. Hopefully this helps someone else.