Created
February 27, 2013 19:52
-
-
Save craftfortress/5051117 to your computer and use it in GitHub Desktop.
Example JSONP Callback
This file contains 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
$(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