JSON Tester
From Plings Info
This code by Howie at http://www.microbubble.co.uk was made to test the JSON output from the API. It uses the Google AJAX Libraries API to do it's thing.
The first call will probably fail, because you are making a call to a remote server, the second using JSONP should work.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title>JSON Test</title> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("jquery", "1.3.2"); google.setOnLoadCallback(function() { // Create plings functions jQuery.fn.plings_json = function() { return this.each(function() { $el = $(this); $result = $("<ul></ul>").appendTo($el); $json = $.ajax({ type: "GET", url: "http://plings.in/feeds/json.activity.php/0/la/00BS", dataType: "json", success: function(json) { $.each(json.activities, function(i,item){ $result.append('<ul>'+item.Name+'</ul>'); }); }, error: function(XMLHttpRequest, status, error) { $result.append('<ul>Error: '+status+'</ul>'); }, }); }); }; jQuery.fn.plings_jsonp = function() { return this.each(function() { $el = $(this); $result = $("<ul></ul>").appendTo($el); $.getJSON("http://plings.in/feeds/json.activity.php/0/la/00BS?callback=?", function(json){ $.each(json.activities, function(i,item){ $result.append('<ul>'+item.Name+'</ul>'); }); }); }); }; }); function getJson() { $("#plings-json").plings_json(); } function getJsonp() { $("#plings-jsonp").plings_jsonp(); } </script> </head> <body> <h3>JSON Test</h3> <p><a href="#" onclick="javascript: getJson();">Get Data</a></p> <div id="plings-json"></div> <h3>JSONP Test</h3> <p><a href="#" onclick="javascript: getJsonp();">Get Data</a></p> <div id="plings-jsonp"></div> </body> </html>

