{"id":19423627,"url":"https://github.com/englercj/jquery-ajax-progress","last_synced_at":"2025-02-25T04:30:14.185Z","repository":{"id":4755479,"uuid":"5905509","full_name":"englercj/jquery-ajax-progress","owner":"englercj","description":"Simple patch that adds a 'progress' callback to jquery Ajax calls","archived":false,"fork":false,"pushed_at":"2018-07-06T16:20:02.000Z","size":3496,"stargazers_count":119,"open_issues_count":1,"forks_count":82,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-02-23T12:48:21.876Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"dypsilon/frontend-dev-bookmarks","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/englercj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-21T18:21:13.000Z","updated_at":"2024-06-13T17:48:39.000Z","dependencies_parsed_at":"2022-09-16T13:11:35.050Z","dependency_job_id":null,"html_url":"https://github.com/englercj/jquery-ajax-progress","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/englercj%2Fjquery-ajax-progress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/englercj%2Fjquery-ajax-progress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/englercj%2Fjquery-ajax-progress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/englercj%2Fjquery-ajax-progress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/englercj","download_url":"https://codeload.github.com/englercj/jquery-ajax-progress/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240603692,"owners_count":19827745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T13:40:06.139Z","updated_at":"2025-02-25T04:30:14.101Z","avatar_url":"https://github.com/englercj.png","language":"HTML","funding_links":[],"categories":["13. 页面交互"],"sub_categories":["13.6 进度条/加载动画(Loading) ###","13.6 进度条/加载动画(Loading)"],"readme":"## Jquery Ajax Progresss\n\nA simple patch to jQuery that will call a 'progress' callback, using the \n[XHR.onProgress](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest#Monitoring_progress) event\n\n### Usage\n\nSimply include the script on your page:\n\n```html\n\u003cscript src=\"js/jquery.ajax-progress.js\"\u003e\u003c/script\u003e\n```\n\nThen, whenever you make an ajax request, just specify a progress callback:\n\n```javascript\n$.ajax({\n    method: 'GET',\n    url: 'data/bird.json',\n    dataType: 'json',\n    success: function() { },\n    error: function() { },\n    progress: function(e) {\n        //make sure we can compute the length\n        if(e.lengthComputable) {\n            //calculate the percentage loaded\n            var pct = (e.loaded / e.total) * 100;\n\n            //log percentage loaded\n            console.log(pct);\n        }\n        //this usually happens when Content-Length isn't set\n        else {\n            console.warn('Content Length not reported!');\n        }\n    }\n});\n```\n\nYou can see it in action on the `demo.html` page.\n\n### Notes\n\n - This will not work using the `file://` protocol, see [XMLHttpRequest - Monitoring Progress](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest/Using_XMLHttpRequest#Monitoring_progress) for more info.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenglercj%2Fjquery-ajax-progress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenglercj%2Fjquery-ajax-progress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenglercj%2Fjquery-ajax-progress/lists"}