Vanilla JavaScript $.getJSON version with callback

1
2
// Remember XHMLHTTP requests are asynchronous!!
function getJSON(url, callback) {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
How to do a simple getJSON replacement for vanilla javascript without the need of Angular's HTTP module or jQuery's $.getJSON method. Careful, this does not work (apparently) with JSONP requests.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.