Polymer Iron-Ajax
The <iron-ajax> element is used to make Ajax calls.
Syntax:
When you set auto to true, a request is made by an element every time its properties url, params, or body are changed.
Parameter explanation:
url: It specifies an attribute where you place the url to the API endpoint.
params: It specifies an attribute where you can pass the JSON with the request parameters.
handle-as: It specifies what data must be stored in the response property. By default, the data is stored in the JSON format.
on-response: It specifies an attribute which can tell the iron-ajax component by what method the response is handled.
Changing multiple attributes sequentially causes automatically generated requests to be debounced.
You can call generateRequest on the element to trigger a request explicitly.
Example:
Output: