Created
January 18, 2019 15:14
-
-
Save lili668668/411362f7bb57af90bb15c64d92ee3894 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>Bridgewell</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> | |
</head> | |
<body> | |
<script> | |
(function (i, max_i) { | |
const callAjax = (cnt) => { | |
return new Promise((resolve) => { | |
$.ajax({ | |
url: 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.' + cnt + '/jquery.min.js', | |
success: resolve | |
}) | |
}) | |
} | |
const callAjaxAgain = (cnt) => { | |
return callAjax(cnt) | |
.then(() => { | |
console.log(cnt) | |
cnt++ | |
if (cnt < max_i) callAjaxAgain(cnt) | |
}) | |
} | |
callAjaxAgain(i) | |
})(1, 5); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment