Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var getHTML = function ( url, callback ) {
- // Feature detection
- if ( !window.XMLHttpRequest ) return;
- var xhr = new XMLHttpRequest();
- xhr.onreadystatechange = function() {
- if (this.readyState == 4 && this.status == 200) {
- callback(this.response);
- }
- };
- // Get the HTML
- xhr.open( 'GET', url, true );
- xhr.responseType = 'json';
- xhr.send();
- };
- getHTML('https://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=Tom_Clancy%27s_The_Division_2&rvsection=0&origin=*', function(jsonResponse) {
- var searchString = jsonResponse.query.pages['56786234'].revisions[0]['*'];
- document.querySelector("h1").innerHTML = searchString.split('| released = ')[1].split('{')[0];
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement