Accessing a java-script file using flask



Hi, I’m trying to access my ‘main.js’ file which I have in a static directory (‘static/main.js’) using flask.
I’m not getting any 404 errors when I run the flask application, so I think my main.js file is accessible, but when I “run” my main.js code within cloud 9, I receive the following error message:

" ReferenceError: XMLHttpRequest is not defined"

Here is my html code/link to the file:

 <link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}">

 <script type="text/javascript" href="{{ url_for('static', filename='main.js') }}"> </script>
<div id="data"></div>

Here is my javascript code for main.js:

var xhr = new XMLHttpRequest();

//Open the connection:“GET”, “”);

xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById(“data”).innerHTML = this.responseText;

Here is my python/flask code:

def quiz():
return render_template(‘index.html’, riddle_data = random.choice(riddles))

if name == ‘main’:“IP”),

Any and all help welcome, thanks…