67 087
Assignments Done
99,3%
Successfully Done
In November 2018

Answer to Question #5780 in Java | JSP | JSF for Johanni Thunstrom

Question #5780
Every time I try to open my javascript file i get this error on Line: 1 Char: 1 Error: 'window' is undefined Code: 800A1391 Source: Microsoft JScript runtime error

My code is a simple html file, a javascript js file, and a json file. The html and json file opens up but the javascript does not. also the javascript is supposed to make the info in the json file appear on the html page but it does not

this is the javascript

window.onload = function() {
var url = "file:///C:/wamp/www/gumball/sales.json";
var request = new XMLHttpRequest();
request.open("GET", url);
request.onload = function() {
if (request.status == 200) {
updateSales(request.responseText);
}
};
request.send(null);
}
function updateSales(responseText) {
var salesDiv = document.getElementById("sales");
salesDiv.innerHTML = responseText;
}
Expert's answer

Not answered

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions