O'Reilly logo

ASP.NET jQuery Cookbook by Sonal Aneel Allana

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Cross site AJAX querying using jQuery

Web browsers, for security reasons, enforce a 'same domain policy' and allow AJAX calls to pages only on the same domain. One method of getting around this restriction to make cross domain requests is to use JSONP (JSON with padding). In this recipe, we will demonstrate an example of cross site querying using Yahoo! Search API and jQuery AJAX.

Note

JSONP is simply JSON wrapped in a user specified function call. The remote JSONP-enabled service receives a callback function name from the client (the calling script). It then returns the JSON response as a parameter in the specified callback function. This function is subsequently executed on the client browser.

Getting ready

  1. Add a new web form Recipe5.aspx to the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required