Skip to content

Instantly share code, notes, and snippets.

@craftfortress
Created February 27, 2013 19:52
Show Gist options
  • Save craftfortress/5051117 to your computer and use it in GitHub Desktop.
Save craftfortress/5051117 to your computer and use it in GitHub Desktop.
Example JSONP Callback
$(document).ready(function () {
JSONP('http://URL.json?cb=JSONP');
function JSONP(URL) {
$.ajax({
url: URL,
dataType: 'jsonp',
data: {
get_param: 'posts'
},
jsonp: 'cb',
success: function (data) {
$.each(data, function (i, threads) {
$("<div/>").text(threads).appendTo("#holder1");
console.log(item)
})
},
done: function (data) {
$("<div/>").text(data.posts.filename).appendTo("#holder");
},
fail: function () {
console.log('fail');
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment