聚合物核心-ajax:找不到 php

问题描述 投票:0回答:1

我创建聚合物元素(w/core-ajax)以将数据发布到php文件。我收到此错误,似乎数据无法发送到php文件。

这个错误与我的服务器有关吗?我使用 yeoman+polymer 生成器设置我的项目。 这是我的错误:“无法 POST /elements/register-el/register.php” http://s1.postimg.org/4c7dmgs1r/ask1.png

注册-el.html

<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/core-ajax/core-ajax.html">
<polymer-element name="register-el" attributes="">
  <template>
    <link rel="stylesheet" href="register-el.css">
    <div class="body-reg">
          <paper-input-decorator class="custom" label="First Name" floatingLabel autoValidate error="Firstname is required!">
              <input is="core-input" type="text" value="{{fname}}" id="fname" required>
          </paper-input-decorator>


          <paper-input-decorator class="custom"label="Last Name" floatingLabel autoValidate error="Lastname is required!">
              <input is="core-input"  type="text" value="{{lname}}" id="lname" required>
          </paper-input-decorator>

          <paper-input-decorator class="custom" label="Email" floatingLabel error="Email is required!" autoValidate>
              <input is="core-input" required type="email" id="email" value="{{email}}">
          </paper-input-decorator>

          <paper-input-decorator class="custom" label="Password" floatingLabel error="Must contain 8 or more characters that are of at least one number, and one uppercase and lowercase letter" autoValidate>
              <input is="core-input" value="{{pwd}}" id="password" type="password" name="pwd1" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}">
          </paper-input-decorator>

          <paper-input-decorator class="custom" label="Re-type Password" floatingLabel error="input is required!" autoValidate>
              <input is="core-input" value="{{cpwd}}" id="confirm_password" type="password" required pattern="{{pwd}}">
          </paper-input-decorator>


           <paper-button raised on-click="{{submit}}">
            <core-icon icon="done"></core-icon>
            Register
          </paper-button>
            <paper-toast id="donereg" text="Your have been registered!Go to login page">
                <div style="color: #E9E88B" on-click="{{gotologin}}" id="gotolog">LOGIN</div>
            </paper-toast>
          <core-ajax
          id="ajaxsubmit"

            url="elements/register-el/register.php"
            method='POST'
            headers='{"X-Requested-With": "XMLHttpRequest"}'
            params='{"firstname":"{{fname}}","lastname":"{{lname}}","email":"{{email}}","password":"{{cpwd}}"}'
            response="{{response}}"></core-ajax>
          </div>
  </template>
  <script>
    (function () {
      Polymer({

      submit: function () {
          if (this.$.confirm_password.validity.valid && this.$.password.validity.valid && this.$.email.validity.valid && this.$.fname.validity.valid && this.$.lname.validity.valid) {
              console.log("Right!");
              this.$.donereg.show();
              this.$.ajaxsubmit.go();
          }
          else{
            console.log("Error");
            console.log(this.fname);

          }
        },
       gotologin : function () {
        document.querySelector('app-router').go('/login');
        },
        responseChanged : function (oldvalue) {
          console.log(this.response);
        }

      });

    })();
  </script>
</polymer-element>
ajax polymer
1个回答
0
投票

路径永远不会以斜线开头,请使用“./”或将其删除。

© www.soinside.com 2019 - 2024. All rights reserved.