{"id":13408514,"url":"https://github.com/acigna/jquery-ajax-native","last_synced_at":"2025-12-30T02:02:37.515Z","repository":{"id":26752835,"uuid":"30210664","full_name":"acigna/jquery-ajax-native","owner":"acigna","description":"jQuery Plugin that adds XHR2 responseType support","archived":false,"fork":false,"pushed_at":"2019-10-11T14:50:14.000Z","size":15,"stargazers_count":35,"open_issues_count":0,"forks_count":13,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-01T02:47:46.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/acigna.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":"2015-02-02T21:52:26.000Z","updated_at":"2024-06-23T11:38:10.000Z","dependencies_parsed_at":"2022-08-24T10:50:59.157Z","dependency_job_id":null,"html_url":"https://github.com/acigna/jquery-ajax-native","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acigna%2Fjquery-ajax-native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acigna%2Fjquery-ajax-native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acigna%2Fjquery-ajax-native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/acigna%2Fjquery-ajax-native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/acigna","download_url":"https://codeload.github.com/acigna/jquery-ajax-native/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243584284,"owners_count":20314725,"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-07-30T20:00:53.368Z","updated_at":"2025-12-30T02:02:32.484Z","avatar_url":"https://github.com/acigna.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Libraries and Frameworks"],"sub_categories":[],"readme":"# Description\nXHR2 provides a response attribute, that contains a converted response to a native object, depending on the responseType (\"arraybuffer\", \"blob\", \"document\", \"json\"). \n\nSee:\n\nhttps://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-response-attribute\nhttp://www.html5rocks.com/en/tutorials/file/xhr2/?redirect_from_locale=fr\n\nUsing this mechanism provides better performances compared to a javascript way of conversion. For example, converting an ArrayBuffer, leads to a heavy loop (See: http://updates.html5rocks.com/2012/06/How-to-convert-ArrayBuffer-to-and-from-String).\n\nThis jQuery Plugin adds XHR2 responseType support, that is currently lacking support in jQuery.ajax and probably remains\nin the future (See the last comments on this [pull request](https://github.com/jquery/jquery/pull/1525)).\n\nPlease, take a look at XHR2 current support [here](http://caniuse.com/#feat=xhr2) for more precision on the support status.\n\n# Usage\nThe plugin provides two means to get a native ajax response as follows.\n\n## Using jQuery.ajax\nThe Plugin provides the native data type for the ajax method that you should use to have a native response. You should also precise the responseType on xhrFields to precise the expected native data type. This usage method allows more customization but\nit is more verbose.\n``` javascript\n$.ajax({\n    dataType: 'native',\n    url: dataUrl,\n    xhrFields: {\n      responseType: 'arraybuffer'\n    },\n    success: successCallback\n});\n```\n\n## Using jQuery.getNative wrapper method\nThe getNative method is a shortened version of the previous method. It allows to specify a success callback only, but returns a promise, and so permets to add the error case.\n``` javascript\n//With success callback\n$.getNative( dataUrl, successCallback );\n//Using the returned promise (success and error callbacks respectively)\n$.getNative( dataUrl ).then( successCallback, errorCallback );\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facigna%2Fjquery-ajax-native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Facigna%2Fjquery-ajax-native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Facigna%2Fjquery-ajax-native/lists"}