如何从铁形式的Polymer 1请求中获得响应 [英] How to get response from an iron-form Polymer 1 request
问题描述
我正在尝试从Polymer 1 中的铁形式获得回复。
i'm trying to get the response from an iron-form in Polymer 1
.
表单提交调用一个PHP脚本,该脚本返回HTML代码以插入 div
( ul
和一些 li
)。
Form submit call a php script which return HTML code to insert in a div
(ul
and some li
).
我使用铁形式
事件铁形态响应
但我不知道如何得到答复。
I use the iron-form
event "iron-form-response
" but i don't know how to get the response.
我可以看到网络标签中的响应浏览器开发人员工具,但不知道如何在我的元素中获取它。
I can see the response in network tab of browser developer tools, but don't know how to get it in my element.
我在中找不到怎么办铁表格在线。
有人可以帮帮我吗?
推荐答案
发生什么事,伙计们?只有这么简单时,所有这些回复都会混淆OP:
What's happening, guys? All these responses confuse the OP when it is only this simple:
您的表格:
<form is="iron-form" on-iron-form-response="responseHandler" action="http://localhost" id="myform">
<!-- Your form elements -->
</form>
您的剧本
<script>
Polymer({
// Some scripts here.
// ...now your listener
responseHandler: function(e) {
console.log(e.detail.response);
},
});
</script>
就是这样。没什么复杂的。不要过于复杂。
It's just that. Nothing complicated. Don't over-complicate things.
这篇关于如何从铁形式的Polymer 1请求中获得响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!