Created
April 21, 2013 03:50
-
-
Save jalalhejazi/5428388 to your computer and use it in GitHub Desktop.
AJAX: SuperWebApps.dk API get_recent_posts JSON
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://jsfiddle.net/jalalhejazi/wWPs5/ | |
$(function () { | |
//Add ul html to body | |
$('body').html('<ul id="results">'); | |
//Call JSONP to CORS SuperWebApps.dk/API REST.get | |
$.ajax({ | |
type: 'get', | |
dataType: "jsonp", | |
url: 'http://superwebapps.dk/api', | |
data: { | |
json: "get_recent_posts" | |
}, | |
success: function (data) { | |
if (data) $.each(data.posts, function (k, v) { | |
console.log(v.title, v.url); | |
var link = "<a href='" + v.url + "'>" + v.title + "</a>" | |
$('ul#results').append('<li>' + link + '</li>'); | |
}); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try it online:
http://jsfiddle.net/jalalhejazi/wWPs5/1/