Я работаю над разделом в моем коде, который работает с Polymer. Я создал форму, которая должна POST в файл PHP в каталоге (с именем API), который связывается с нашим SQL. Вместо успешной отправки данных на register-wine.php
файл, я получаю ошибку 404, которая приходит с несколькими другими ошибками файла Polymer. Любая идея, почему эти ошибки происходят?
Оскорбляющий HTML-файл:
<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/paper-menu/paper-menu.html">
<link rel="import" href="../bower_components/iron-form/iron-form.html">
<link rel="import" href="../bower_components/iron-input/iron-input.html">
<link rel="import" href="../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
<link rel="import" href="../bower_components/paper-item/paper-item.html">
<link rel="import" href="../bower_components/paper-listbox/paper-listbox.html">
<link rel="import" href="shared-styles.html">
<dom-module id="wc-view2">
<template>
<style include="shared-styles">
:host {
display: block;
padding: 10px;
}
</style>
<div class="card">
<h1>Register Wine</h1>
<div left>
<!--- <wc-register id="wc-register-wine" method = "post" action="api/register-wine.php" ></div> --->
<div id ="register-wine-container">
<form is="iron-form" id="register-wine-form" method="post" disable-native-validation-ui action="../api/register-wine.php">
<h3>Insert Wine Data! </h3>
<paper-input-container>
<input is="iron-input" id = "inputProducer" name ="producer" type ="text" placeholder = "Producer" required>
<!---Can insert Icon for prettiness, but will later, lets get functionality-->
</paper-input-container>
<paper-input-container>
<input is="iron-input" id = "inputName" name ="wname" type ="text" placeholder = "Wine Name" required>
<!---Can insert Icon for prettiness, but will later, lets get functionality-->
</paper-input-container>
<paper-input-container>
<input is="iron-input" id = "inputGrape" name ="grape" type ="text" placeholder = "Grape (Optional)">
<!---Can insert Icon for prettiness, but will later, lets get functionality-->
</paper-input-container>
<paper-dropdown-menu label="Wine Style">
<paper-listbox class="dropdown-content" name = "wine_styles">
<paper-item>Sparkling White</paper-item>
<paper-item>Sparkling Rosé</paper-item>
<paper-item>Stil White</paper-item>
<paper-item>Still Red</paper-item>
<paper-item>Dessert</paper-item>
<paper-item>Fortified White</paper-item>
<paper-item>Fortified Red</paper-item>
</paper-listbox>
</paper-dropdown-menu>
<paper-input-container>
<input is="iron-input" id = "inputVintage" name ="vintage" type ="number" placeholder = "Vintage (YYYY)" required>
<!---Can insert Icon for prettiness, but will later, lets get functionality-->
</paper-input-container>
<paper-input-container>
<input is="iron-input" id = "inputCountry" name ="country" type ="text" placeholder = "Country" required>
<!---Can insert Icon for prettiness, but will later, lets get functionality-->
</paper-input-container>
<paper-input-container>
<input is="iron-input" id = "inputState" name ="state" type ="text" placeholder = "State/Province" required>
<!---Can insert Icon for prettiness, but will later, lets get functionality-->
</paper-input-container>
<paper-input-container>
<input is="iron-input" id = "inputRegion" name ="region" type ="text" placeholder = "Region (Optional)">
<!---Can insert Icon for prettiness, but will later, lets get functionality-->
</paper-input-container>
<paper-input-container>
<input is="iron-input" id = "inputSubRegion" name ="sRegion" type ="text" placeholder = "Sub-Region (Optional)">
<!---Can insert Icon for prettiness, but will later, lets get functionality-->
</paper-input-container>
<paper-input-container>
<input is="iron-input" id = "inputVintage" name ="vintage" type ="number" placeholder = "Alcohol Percentage (##)" required>
<!---Can insert Icon for prettiness, but will later, lets get functionality-->
</paper-input-container>
<button name="regWine" type="submit">Register Wine</button>
</form>
</div>
</div>
<div right></div>
</div>
</template>
<script language = "javascript">
window.onbeforeunload = function(){
return 'Are you sure you want to leave?';
};
</script>
<script>
Polymer({
is: 'wc-view2'
});
</script>
</dom-module>
Вот моя файловая структура:
Файловая структура
Вот ошибка, и что содержит ошибка (следующая первая строка):
iron-request.html:304 POST http://localhost:8080/api/register-wine.php 404 (Not Found)
send @ iron-request.html:304
generateRequest @ iron-ajax.html:455
submit @ iron-form.html:251
_onSubmit @ iron-form.html:262
handler @ polymer.html:561
Задача ещё не решена.
Других решений пока нет …