Skip to content

Instantly share code, notes, and snippets.

@moyhig
Created November 8, 2012 13:05
Show Gist options
  • Save moyhig/4038684 to your computer and use it in GitHub Desktop.
Save moyhig/4038684 to your computer and use it in GitHub Desktop.
2012/11/08
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