on-core-response="{{handleResponse}}" is using Polymer's on-* declarative
event handling
<https://www.polymer-project.org/docs/polymer/polymer.html#declarative-event-mapping>
.
response="{{resp}}" data binds core-ajax's published response property to
a property `resp` that you can use elsewhere in the your app.
In your example, you're not defining a handler for the `on-core-response`
so `handleResponse` is never called. Instead, you can define a `
responseChanged` changed handler
<https://www.polymer-project.org/docs/polymer/polymer.html#observeprops> to
know when the form was submitted.
On Mon, Nov 10, 2014 at 4:53 AM, James L <[email protected]> wrote:
> What is the difference between response="" and on-core-response=""
>
> How do I receive the response once the form is submitted through AJAX?
>
> PHP:
> <?php
> //Capture all inputs - $request_body = file_get_contents('php://input');
> echo 'Your email is subscribed to our mailing list.';
> ?>
>
> HTML:
> ...
> </form>
> <core-ajax id="ajax" method="POST" url="r.php" params="{{item}}"
> response="{{response}}"></core-ajax>
> <template repeat="{{response}}">{{data}}</template>
> {{response}}
> <br>
> </template>
> <script>
> Polymer('add-node', {
> created: function() {
> this.item = {};
> },
> doSend: function() {
> this.$.ajax.go();
> },
> * handleResponse: function(e) { //Don't seem to work?*
> * console.log("You got mail!");*
> * }*
> });
> </script>
>
> Follow Polymer on Google+: plus.google.com/107187849809354688692
> ---
> You received this message because you are subscribed to the Google Groups
> "Polymer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/polymer-dev/bdcb8f35-5e7c-46ff-a25f-72fddc0ad147%40googlegroups.com
> <https://groups.google.com/d/msgid/polymer-dev/bdcb8f35-5e7c-46ff-a25f-72fddc0ad147%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/polymer-dev/CACGqRCDaNaFVZa8k4uxxxWq7ST_spz6LU6fzz4N_YNW%2BnLvQyg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.