OLD | NEW |
(Empty) | |
| 1 |
| 2 <!--- |
| 3 |
| 4 This README is automatically generated from the comments in these files: |
| 5 iron-ajax.html iron-request.html |
| 6 |
| 7 Edit those files, and our readme bot will duplicate them over here! |
| 8 Edit this file, and the bot will squash your changes :) |
| 9 |
| 10 The bot does some handling of markdown. Please file a bug if it does the wrong |
| 11 thing! https://github.com/PolymerLabs/tedium/issues |
| 12 |
| 13 --> |
| 14 |
| 15 [![Build status](https://travis-ci.org/PolymerElements/iron-ajax.svg?branch=mast
er)](https://travis-ci.org/PolymerElements/iron-ajax) |
| 16 |
| 17 _[Demo and API docs](https://elements.polymer-project.org/elements/iron-ajax)_ |
| 18 |
| 19 |
| 20 ## <iron-ajax> |
| 21 |
| 22 The `iron-ajax` element exposes network request functionality. |
| 23 |
| 24 ```html |
| 25 <iron-ajax |
| 26 auto |
| 27 url="https://www.googleapis.com/youtube/v3/search" |
| 28 params='{"part":"snippet", "q":"polymer", "key": "YOUTUBE_API_KEY", "type":
"video"}' |
| 29 handle-as="json" |
| 30 on-response="handleResponse" |
| 31 debounce-duration="300"></iron-ajax> |
| 32 ``` |
| 33 |
| 34 With `auto` set to `true`, the element performs a request whenever |
| 35 its `url`, `params` or `body` properties are changed. Automatically generated |
| 36 requests will be debounced in the case that multiple attributes are changed |
| 37 sequentially. |
| 38 |
| 39 Note: The `params` attribute must be double quoted JSON. |
| 40 |
| 41 You can trigger a request explicitly by calling `generateRequest` on the |
| 42 element. |
| 43 |
| 44 |
| 45 |
| 46 ## <iron-request> |
| 47 |
| 48 iron-request can be used to perform XMLHttpRequests. |
| 49 |
| 50 ```html |
| 51 <iron-request id="xhr"></iron-request> |
| 52 ... |
| 53 this.$.xhr.send({url: url, body: params}); |
| 54 ``` |
| 55 |
| 56 |
OLD | NEW |