Currently, I am working on creating a straightforward photo upload system. When a file is selected and the upload button is clicked, a loading gif appears along with a percentage uploaded. Once the upload is complete, an alert displays a message from an array containing various feedback messages.
Despite my initial idea not yielding results, I resorted to using an array for the feedback messages. Is there a way to utilize a .txt file as the responseText for my AJAX request? For example, if the text file contains the phrase Images Uploaded To Server
, how can I extract that information from the file and display it in an alert after the upload?
This function is currently invoked upon completion of the upload...
xhr.addEventListener("load", function() { document.getElementById("loadingicon").style.display = "none";
alert(message[0]); addIcon();} , false);
I attempted to use .open("GET", "text.txt", true);
but encountered an error stating Undefined
.
Can anyone offer assistance with this issue?