Hello. I'm doing something very simple, and yet it's not working.. maybe I'm missing something.
I need to read a text file, through ajax, and into a div. I can easily write to the file through ajax, but not read. Here is what I have:
function ajaxLoader(url)
{
if(document.getElementById)
{
var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new
XMLHttpRequest();
}
if(x)
{
x.onreadystatechange = function()
{
if(x.readyState == 4 && x.status == 200)
{
el = document.getElementById('content');
el.innerHTML = x.responseText;
}
}
x.open("GET",url, true);
x.send(null);
}
}
<a class="blocklink" href="#" id="readg" onclick="ajaxLoader('guestBook.txt')">Read The Guestbook</a></p>
<div id="content" style="width:600px;">
I've been stuck on this all day. I can use all of the same code, and output a regular html file to the div, but not this .txt file. The txt file has all of the read write privileges it needs. Thanks!
Marcus