I found this question on setting the response type to json from a jsp but I\'m in need of setting the response type to jsonp for cross-domain access. Would it still be this:
I recently had to do this. In the server side I had something like so:
string callbackName = queryMap['callback']; //jquery will pass in some name in our .getJSON call below
string jsonData = getJsonData();
string jsonp = callbackName + "(" + jsonData + ")";
response.SetContentType('application/javascript');
response.Send( jsonp );
And in the javascript it was something like so:
var url = getUrl() + "?callback=?";
$.getJSON(url,function(onSuccessData){ alert(onSuccessData); });