我想通过 transcrypt 代码获取文件。通常这是通过 XMLHttpRequest 完成的。在 Javascript 脚本中,新的构造函数用于此目的。我如何进行转加密?这是我不工作的代码:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def read_file():
xmlhttp=XMLHttpRequest()
xmlhttp.open('GET', "https://raw.githubusercontent.com/bunkahle/Transcrypt-Examples/master/README.md", False);
xmlhttp.send()
console.log(xmlhttp.responseText)
和html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="__javascript__/read_file.js"></script>
<title>Read File</title>
</head>
<body>
<main>
<h1>Read a file!</h1>
<p id="p1" class="para1">Read a file!</p>
<button id="button1" onclick="read_file.read_file()">Click for retrieving text file</button><br><br>
<p id="demo"></p>
</main>
</body>
</html>