polymer form using paper-input and core-ajax -


I am working on a custom element that uses a quiet service to send the methode node data to a database Will work in the form.

I have 3 questions about this element.

  1. Can this also work? I am trying to use a method that seems unlike the data binding method when collecting data from a server. It can be used to send to the server.

  2. In the main-Ajax element I am using the automatic = "false" attribute.

  3. If this method can be used to send, how can I capture the body = "{}" when the line in the submitted PHP? I know that it has not been sent as $ _GET, it has been sent as $ _POST, or do I need to use any other method to capture it?

My element template currently appears

   & Lt; Paper-input floating label label = "street address:" value = "{{address}}" & gt; & Lt; / Paper-Input & gt; & Lt; Br> & Lt; Paper-input Floating Label Label = "City" Value = "{{city}}" & gt; & Lt; / Paper-Input & gt; & Lt; Br> & Lt; Paper-input Floating Label Label = "State" Value = "{{state}}" & gt; & Lt; / Paper-Input & gt; & Lt; Br> & Lt; Paper-input floating label label = "zip" value = "{{zip}}" & gt; & Lt; / Paper-Input & gt; & Lt; Br> & Lt; Paper-input floating label label = "phone:" value = "{{phone}}" & gt; & Lt; / Paper-Input & gt; & Lt; Br> & Lt; Paper-input floating label label = "description:" value = "{{description}}"> & Lt; / Paper-Input & gt; & Lt; Br> & Lt; Div class = "centered" & gt; & Lt; Paper-Button On-Tap = "{{doSend}}" Raise Button Class = "Colorful" Label = "Save" & gt; & Lt; / Paper-button & gt; & Lt; / Div & gt; & Lt; / Form & gt; & Lt; Core-ajax id = "ajax" auto = "false" method = "POST" contentType = "application / json" url = "{{url}}" body = '{"name": "{{name}}" { "{{Condition}}", "city": "{{city}}", "state": "{{state}}", "zip": "{{zip}}", "" {{Phone}} " , "Description": "{{description}}", "longitude": "{{lng}}", "latitude": "{{lat}}"} 'response = "{{feedback}}" & gt; & Lt; / Core-ajax & gt; & Lt; Repeat template = "{{response}}" & gt; {{Data}} & lt; / Template & gt; & Lt; / Template & gt; & Lt; Script & gt; Polymer ('ad-node', {doSend: function (event, extension, sender) {this $. Ajax.go ();}}); & Lt; / Script & gt; & Lt; / Polymer element & gt;  

It should work just fine. Give go () an ID to your AJAX element so that it is easy to access, i.e.

  & lt; Core-ajax id = "foobar" auto = "false" ... & gt; & Lt; / Core-ajax & gt;  

Attach an event handler to the button

  & lt; Paper-button ... on-tap = "{{doSend}}" & gt; & Lt; / Paper button & gt;  

and implement the doSend () handler in your elements script section (Do not forget to get rid of noscript in elements )

  & lt; Script & gt; Polymer ('ad-node', {doSend: function (event, extension, sender) {it. $. Foobar.go ();}}); & Lt; / Script & gt;  

On the server side as the receipt of data - yes, you should see the data in the $ _ POST .


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -