javascript - How to update jQuery-UI progress bar with AJAXcall (files scan) -


i want hash files in specific folder ajax , update progress, meaning don't want ajax stop @ first reply. searched online , thing found right answer doesn't work.

my jquery( mixed js):

jquery(document).ready(function($) { $('#progress').progressbar();  document.getelementbyid('save').onclick = function() {     var div = document.getelementbyid('save_log');     var security = $('#save_security').val();      div.innerhtml = '';      xhr = new xmlhttprequest();     xhr.open("post", checkit.admin_ajax, false);      xhr.onprogress = function(evt) {         //var json = json.parse(e.currenttarget.responsetext);         //var percentcomplete = ( json.currentfile * 100 ) / json.filescount;           var progress = evt.currenttarget.responsetext;          $('#progress').progressbar("value", progress);        }      xhr.onreadystatechange = function() {         if (xhr.readystate == 4) {             console.log(xhr);         }     }      xhr.setrequestheader("content-type","application/x-www-form-urlencoded");     xhr.send("action=checkit_scan_files&security=" + security); };  }); 

and php ajax

        $iterator = new recursivedirectoryiterator($dir);     $iterator->setflags(recursivedirectoryiterator::skip_dots);      $fi = new recursiveiteratoriterator( $iterator );      $files = array();      $i = 1;     $size = $this->get_files_count();      foreach ($fi $file) {          if ( !$file->isdir() ) {              $files[$i]['md5'] = md5_file( $file->getpathname() );              $files[$i]['path'] = $file->getpathname();              $progress = ($i * 100) / $size;             $i++;              echo intval( $progress );         }      } 


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -