I am using AJAX2 as described here
to monitor progress of ajax request, but i am receiving following error "TypeError: Not enough arguments to XMLHttpRequest.open."
Can anyone help why this error occuring?
My Code is:
var oReq = new XMLHttpRequest();
oReq.addEventListener("progress", updateProgress);
oReq.addEventListener("load", transferComplete);
oReq.addEventListener("error", transferFailed);
oReq.addEventListener("abort", transferCanceled);
oReq.open();
// ...
// progress on transfers from the server to the client (downloads)
function updateProgress (oEvent) {
if (oEvent.lengthComputable) {
var percentComplete = oEvent.loaded / oEvent.total;
console.log(percentComplete+ " percent completed.");
// ...
} else {
console.log(" Unable to compute progress information since the total size is unknown.");
// Unable to compute progress information since the total size is unknown
}
}
function transferComplete(evt) {
console.log("The transfer is complete.");
}
function transferFailed(evt) {
console.log("An error occurred while transferring the file.");
}
function transferCanceled(evt) {
console.log("The transfer has been canceled by the user.");
}
Actuall error is occuring on this line
oReq.open();
open() method has three parameters open('get' , url , true or false or null)