2.2.0 • Published 4 years ago

oe-ajax v2.2.0

Weekly downloads
31
License
MIT
Repository
github
Last release
4 years ago

<oe-ajax>

The oe-ajax element exposes network request functionality.

Forked from iron-ajax due to below issue and it adds access token to the header when a request is made.

<oe-ajax
    auto
    url="https://www.googleapis.com/youtube/v3/search"
    params='{"part":"snippet", "q":"polymer", "key": "YOUTUBE_API_KEY", "type": "video"}'
    handle-as="json"
    on-response="handleResponse"
    debounce-duration="300"></oe-ajax>

With auto set to true, the element performs a request whenoeer its url, params or body properties are changed. Automatically generated requests will be debounced in the case that multiple attributes are changed sequentially.

Note: The params attribute must be double quoted JSON.

You can trigger a request explicitly by calling generateRequest on the element.

<oe-request>

oe-request can be used to perform XMLHttpRequests.

<oe-request id="xhr"></oe-request>
...
this.$.xhr.send({url: url, body: params});