Yahoo Pipes example

This example shows how to use Yahoo Pipes to connect to Trove People and Organisations query

HTML

<div id="input">
    <span>Name</span>
    <input id="pname" type="text" />
    <button id="getDetails">Get Details</button>
</div>
<ul id="output"></ul>

CSS

#input { padding-bottom: 10px; }
#output { 
    padding-top: 5px; 
    border-top: solid 1px black; 
    line-height: 2em;
    list-style-type: disc;
    padding-left: 15px;
}

JavaScript

// action that occurs when the 'Get Details' button is pressed
    // Get the value of the Name field
    var pName = $("#pname").val();
    // Construct the URL for the Yahoo Pipe for Trove People query
    var url = "http://pipes.yahoo.com/pipes/pipe.run?_id=c04ff347de5c25a214f4b8b7e5ca03ed&_render=json&LocationID=" + pName;

    // Get the JSON result
    $.getJSON( url, function( data ) {
        var outputHTML = "";
        var record=data.value.items[0].content;
        outputHTML += "<li><a target='_blank' href='" 
              + record 
              +"'>"  
              + record 
              + "</a></li>";
        $('#output').html(outputHTML); 
    });