Is it possible to get cross domain ajax in mvc architectre? I am using jsonp and it works perfectly if both the sites are in localhost. My doubt is that, whether the mvc architecture blocks the jsonp call.?? <script src="www.example.com"></script>
$.ajax({ url: "www.example.com?id=abc&callback=?", dataType: "jsonp" });
function mycallback(data)
{`alert(data);`
}
Returning JSONP data does not come out of the box in ASP.NET MVC 3 and you need write wrapper for it.
What is JSONP ?
Server return JSONP with added "?callback=" to the querystring, so server would process the request, and instead of returning a JSON object or XML, it responds with an “application/x-javascript” response using the callback parameter as a wrapper function, so when request is answered, the browser will execute the JavaScript returned.