Information Technology Reference
In-Depth Information
Figure 12-13. The topic Pipe I created
You'll notice that Yahoo! Pipes gives me options for how I want to access my Pipe. I can
access it as an RSS feed itself, or I can get it as a JSON result output. Under “More
Options” I can also configure to get my results by e-mail or through PHP. For this
example, I'm going to want to get my results as JSON. You'll recall that we've used
JSON earlier in the topic, in our apps in Chapters 2 and 3. Here, we're using it again to
get the output of our Pipe. Clicking on the JSON button gives me a fairly ugly screen full
of content, but it's really the URL that I want to remember. It looks something like
http://pipes.yahoo.com/pipes/pipe.run?_id=0a1f972788e5ee484b335cb892fc85be&_ren
der=json and it can be called through my AJAX web page.
Second: Get the Output and Display It!
We're going to modify our word-of-the-day example to pull the JSON output and
display it. While there are easier ways to do this (most notably using JSON's getJSON
function, and looping the list items), the code in Listing 12-5 is a bit more drawn out,
which makes iteasier to see exactly what we're doing to parse each item. Later, as a flex
of your JavaScript skills, you can rewrite this code using getJSON if you'd like.
Listing 12-5. mynews.html
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>My News</title>
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script type="text/javascript">
 
Search WWH ::




Custom Search