简体   繁体   中英

measure download progress of large json in javascript w/ jquery

Is there any way to measure and keep track of the progress of downloading a large JSON file using getJSON, or something similar if that can't do it. at the moment, since getJSON has basically only a success callback, i don't know what's going on until the json is done downloading. (upwards of a minute)

if it helps, this will be part of a standalone chrome app and a phonegap app

I ended up following a guide at https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest and using XMLHTTPRequests instead of getJSON

I also had to use some rack middleware on the ruby on rails side to include content-length in the HTTP response for JSON

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM