I have an ajax submit with an xhr upload percentage.
var xhr=new window.XMLHttpRequest()
$.ajax({
xhr:function(){
xhr.upload.addEventListener("progress",function(event){
if(event.lengthComputable){
element.val(Math.round((event.loaded/event.total)*100)+"%")
}
},false)
return xhr
},
)}
Unfortunately, it fires with every submit event. I thought it would only fire with uploads. How can I fix this issue?