php - Polymer 1.0 Iron-form Post error 404 not found -
working polymer 1.0, try implement iron-form element, when use method "get" it's working, when try make "post" same file on same path error occurs 404 not found.
my custom element (contact-form):
<dom-module id="contact-form"> <template> <div class="horizontal center-center layout"> <link rel="import" href="add.php"> <div> <div class="horizontal-saction> <form is="iron-form" id="form" method="post" content-type="application/json" action="add.php"> <paper-input name="name" label="name" requiered></paper-input> <br><br> <paper-button raised onclick="sumitform()">submit</paper-button> </form> </div> </div> </div> </template> <script> function submitform(){ document.getelementbyid('form').submit(); } polymer({ is:'contact-form', });
my add.php contains:
<?php var_dump($_post['name']); ?>
the file path add.php elements/contact-form/add.php , 404 not found, when "post", occurs on same path http: //localhost:5000/elements/contact-form/add.php. not understand because happens. sorry english.
seems me server configuration must doing different , put requests. make no mention of server have , how configured, first check in dev tools if have chrome browser , watch traffic , server.
edit - further update on thought in submitting form
<paper-button id="submit" >submit</paper-button>
then in polymer object listeners: {'submit.tap':'_submitlogon'}, _submitlogon: function() { this.$.form.submit(); }
second edit.
if using gulp serve, using own web server. has no ability run php code. coming raw text of php source code. if stored in place server can find it. wondering how ajax request being handled - since expecting (specifically in post mode, don't understand how worked) json formatted response. source of php isn't json, won't recognise format , error out.
Comments
Post a Comment