I have a plain text file stored at somewhere at a server to which i have the link. Now i want to read the file contents in a string var in my javascript code. Now I have written the code but does not know how to read the contents of the file.
I want to display the contents of the file in an alert box to the user, Can you please help.
var xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange = function()
{
if (this.readyState == 4 && this.status == 200)
{
var parser=new DOMParser();
var xmlDoc = parser.parseFromString(xmlhttp.responseText,"text/html");
}
}
xmlhttp.open("GET",url, false);
xmlhttp.send();
Regards