javascript - How to show Progress in XMLHttpRequest -
i used xmlhttprequest upload file , want display loadingview before submitting file, loadingview not appear , not work.
i use asp.net mvc coding.
in javascript:
// display loading view function updateprogress(oevent) { if (oevent.lengthcomputable) { //loading } else { } } $('body') .on('click', '#bupload', function() { var xmlhttprequest = new xmlhttprequest(); if (!window.xmlhttprequest) { xmlhttprequest = new activexobject("microsoft.xmlhttp"); } xmlhttprequest.addeventlistener("progress", updateprogress); xmlhttprequest.open("post", '@url.action("****", "****", new {area = "****"})', true); xmlhttprequest.send(); });
Comments
Post a Comment