I have a set of data organized into .txt files. I want to display the content of the .txt files on an HTML page using jQuery.
My jQuery:
$(document).ready(function(){
//works:
$("#test").html("what");
//doesn't work:
$.get("test.txt", function(data) {
$("#test").html(data);
alert("loaded: "+data);
});
//doesn't work:
$("#test").load("test.txt", function(){
alert("loaded");
});
});
Both methods I have seen (.get and .load) fail to work for me. The HTML does not change from "what" and no alerts display. I have looked around for around an hour, but all I can find are solutions claiming that these methods work, even though they do not for me. What am I doing wrong?
(And yes, test.txt is in the same folder. The html, js, and txt are all in one folder together.)