I use the following $ .ajax command to download a file from the PhoneGap application:
function updateProgress( evt ) { if ( evt.lengthComputable ) { var percentComplete = evt.loaded / evt.total * 100; console.log( percentComplete + "%" ); } } $.ajax({ url: url, type: "POST", data: data, cache: false, dataType: "json", processData: false, contentType: false, success: successCallback, error: errorCallback, xhr: function() { var xhr = new window.XMLHttpRequest(); xhr.addEventListener( "progress", updateProgress, false); return xhr; } });
Download is working fine. However, a progress event is only triggered once the download is complete. During boot, it does not work at all - so the boot process is not displayed. When downloading, there is a pause, and then 100% is displayed.
Any ideas what I'm doing wrong?
source share