简体   繁体   English

如何在Polymer的另一页上使用Iron-ajax响应?

[英]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? 如何将铁质ajax的响应传递到另一页?

I have two pages which will display different things from the same data(response) . 我有两个页面,它们将显示来自同一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. 有没有一种方法可以将page-x.html中的Iron-ajax的响应传递给page-y.html而无需在每个页面中生成相同的请求。

here the very simple code to pass the iron-ajax 's response to two or more page (element- components); 这里是非常简单的代码,用于将iron-ajax的响应传递到两个或更多页面(元素组件); 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 page-x您将拥有一个xData ,在page-y您将拥有yData属性,其中包含从iron-ajax接收的数据

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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