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();   }); 

you can add event listeners xmlhttprequest.

mdn has documentation on this.

monitoring progress


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -