Displaying data obtained via JSONP
For our final example, let's pull in some external content for our final tabs example. If we use the Tabs widget, in conjunction with the standard jQuery library getJSON
method, we can bypass the cross-domain exclusion policy and pull-in a feed from another domain, to display in a tab. In tabs19.html
, change the Tabs widget so that it appears as follows:
<div id="myTabs"> <ul> <li><a href="#a"><span>Nebula Information</span></a></li> <li><a href="#flickr"><span>Images</span></a></li> </ul> <div id="a"> <p>A nebulae is an interstellar cloud of dust, hydrogen gas, and plasma. It is the first stage of a star's cycle. In these regions the formations of gas, dust, and other materials clump together to form larger masses, which attract further matter, and eventually will become big enough to form stars. The remaining materials are then believed...