Hello,
I'm working in dhtml (html, CSS, JavaScript, and Perl) using the latest Apache / mod_perl server on Windows 10. I don't seem to be able to get ajax to work. I'm trying to 'get' a multiline file (directory and file name) out of a database location. I'm thinking that the response text will return a string of lines separated by new lines (\n). I've tried the w3 simplest approach, jquery, and d3. The w3 approach is below.
var mFn = document.forms[0]['thefdir'].value + 'Measures/all.mea?t=' + Math.random(); // Unique ID bypasses cache.
var xhttp = new XMLHttpRequest();
xhttp.open('GET', 'dog.txt', true);
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
fieldName3.value = this.responseText;
}
};
xhttp.send();
Its executed onChange to a field on a form generated by a Perl CGI program. The fieldName3.value would be processed downstream in the JS. I've tried it with the fully qualified location (mFn) and a relative location (dog.txt) with 1 line in it. Neither worked. I don't know what directory the relative location resolves to. So I put a copy in the server root and the cgi-bin directories. It did not work. Nothing happens and no error information.
Any help will be appreciated.
craigt