Created
September 1, 2019 18:23
-
-
Save jonathands/7f7cd4da48ac8b6bd822878d69a4c184 to your computer and use it in GitHub Desktop.
Concatenating several Links for printing
This file contains hidden or 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
| let tipUrlList = Array(); | |
| let index = 0; | |
| let htmlContent; | |
| document.querySelectorAll("pre a").forEach(function(e){ | |
| tipUrlList.push(e.href); | |
| }); | |
| function loadPage(){ | |
| let xhr = new XMLHttpRequest(); | |
| xhr.onload = function(data){ | |
| console.log('d:on'+index) | |
| htmlContent += (this.responseText); | |
| if(index==tipUrlList.length) | |
| { | |
| console.log('d:c') | |
| document.body.innerhtml = htmlContent; | |
| }else{ | |
| console.log('d:l') | |
| loadPage(index++) | |
| } | |
| } | |
| xhr.open('get',tipUrlList[index]); | |
| xhr.send() | |
| } | |
| loadPage() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment