简体   繁体   中英

How to use an iron-ajax response on another page, in Polymer?

How do I pass the response of an iron-ajax to another page?

I have two pages which will display different things from the same data(response) . Is there a way to pass the response of an iron-ajax in page-x.html to page-y.html without generating the same request in each page.

here the very simple code to pass the iron-ajax 's response to two or more page (element- components); And if you have a specific requirement then re-issue your question in order to make more specific answer.:

<iron-ajax 
         auto
         id="request"
         url="your url here "
         last-response="{{response}}"
> </iron-ajax>
<page-x x-data = "{{response}}"></page-x>
<page-y y-data = "{{response}}"></page-y>

at page-x you will have a xData and at page-y you will have yData property with received data from iron-ajax

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM