jquery-ajax-native

WebJar for jquery-ajax-native

Лицензия

Лицензия

MIT
Категории

Категории

Native Инструменты разработки
Группа

Группа

org.webjars.bower
Идентификатор

Идентификатор

jquery-ajax-native
Последняя версия

Последняя версия

1.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

jquery-ajax-native
WebJar for jquery-ajax-native
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/acigna/jquery-ajax-native

Скачать jquery-ajax-native

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.bower/jquery-ajax-native/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>jquery-ajax-native</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/jquery-ajax-native/
implementation 'org.webjars.bower:jquery-ajax-native:1.0.1'
// https://jarcasting.com/artifacts/org.webjars.bower/jquery-ajax-native/
implementation ("org.webjars.bower:jquery-ajax-native:1.0.1")
'org.webjars.bower:jquery-ajax-native:jar:1.0.1'
<dependency org="org.webjars.bower" name="jquery-ajax-native" rev="1.0.1">
  <artifact name="jquery-ajax-native" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='jquery-ajax-native', version='1.0.1')
)
libraryDependencies += "org.webjars.bower" % "jquery-ajax-native" % "1.0.1"
[org.webjars.bower/jquery-ajax-native "1.0.1"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.bower : jquery jar [1.11,1.12)

Модули Проекта

Данный проект не имеет модулей.

Description

XHR2 provides a response attribute, that contains a converted response to a native object, depending on the responseType ("arraybuffer", "blob", "document", "json").

See:

https://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-response-attribute http://www.html5rocks.com/en/tutorials/file/xhr2/?redirect_from_locale=fr

Using 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).

This jQuery Plugin adds XHR2 responseType support, that is currently lacking support in jQuery.ajax and probably remains in the future (See the last comments on this pull request).

Please, take a look at XHR2 current support here for more precision on the support status.

Usage

The plugin provides two means to get a native ajax response as follows.

Using jQuery.ajax

The 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 it is more verbose.

$.ajax({
    dataType: 'native',
    url: dataUrl,
    xhrFields: {
      responseType: 'arraybuffer'
    },
    success: successCallback
});

Using jQuery.getNative wrapper method

The 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.

//With success callback
$.getNative( dataUrl, successCallback );
//Using the returned promise (success and error callbacks respectively)
$.getNative( dataUrl ).then( successCallback, errorCallback );
org.webjars.bower

Acigna Inc.

Версии библиотеки

Версия
1.0.1