Created
November 8, 2012 13:05
-
-
Save moyhig/4038684 to your computer and use it in GitHub Desktop.
2012/11/08
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
var jsdom = require("jsdom").jsdom; | |
var document = jsdom("<html><head></head><body></body></html>"); | |
var window = document.createWindow(); | |
var url = "http://higashida.net/mediawiki/api.php?action=parse&page=Main_Page&format=json&callback=?"; | |
//var url = "http://en.wikipedia.org/w/api.php?action=parse&page=Markdown&format=json&callback=?"; | |
//var url = "https://api.github.com/gists/3985489?callback=?"; | |
jsdom.jQueryify(window, "http://code.jquery.com/jquery-1.8.1.js", function(window,$) { | |
$.ajaxSetup({"error":function(XMLHttpRequest,textStatus, errorThrown) { | |
console.log("status: " + textStatus); | |
console.log("error: " + errorThrown); | |
console.log("response: " + JSON.stringify(XMLHttpRequest.responseText)); | |
}}); | |
$.getJSON(url, | |
function(data) { | |
console.log(JSON.stringify(data, null, 4) + "\n"); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment