I am struggling to retrieve file names from a server directory using ASP code.
Although I believe the code to be correct, the log is only displaying this message, which is just a snippet of the ASP code and not the entire source code, causing me to receive no results.
Below is the JS code I am working with:
function getFileList() {
$('#fileList').empty();
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
console.log(this.responseText);
$('<option>').text(this.responseText).appendTo('#fileList');
}
}
xhttp.open('GET', scriptPath + 'getFileList.asp', true);
xhttp.send();
$('#loadFiles').show();
} //function getFileList() ends here
And here is the ASP code in question:
<%
Dim objFSO, objFile, objFolder
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(Server.MapPath("/web/Recipes"))
For Each objFile in objFolder.Files
Response.Write objFile.Name & "<br>"
Next
Set objFolder = Nothing
Set objFSO = Nothing
%>
To clarify, the directory structure is as follows: server/web/Recipes/ containing the necessary files.
I am perplexed as to why ASP is not interpreting the entire code, and I am seeking guidance on how to fix this issue.
Thank you.