|
@@ -0,0 +1,15 @@
|
|
|
|
+const xhr = new XMLHttpRequest()
|
|
|
|
+xhr.open('GET', 'http://www.wechall.net/challenge/training/programming1/index.php?action=request')
|
|
|
|
+xhr.send(null)
|
|
|
|
+xhr.onreadystatechange = function(){
|
|
|
|
+ const DONE = 4
|
|
|
|
+ const OK = 200
|
|
|
|
+ if (xhr.readyState === DONE) {
|
|
|
|
+ if (xhr.status === OK) {
|
|
|
|
+ const flag = xhr.responseText
|
|
|
|
+ window.location.href = 'http://www.wechall.net/challenge/training/programming1/index.php?answer=' + flag
|
|
|
|
+ } else {
|
|
|
|
+ console.log("Error: "+ xhr.status)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|