Неопределенная ошибка в jquery tokeninput

jQuery tokeninput возвращает ноль значение. когда я отправляю форму, массив $ _POST [] становится пустым.

в демонстрация когда я нажимаю кнопку «Отправить», появляется предупреждение: «будет отправлено:» и значения. Я сделал то же самое в моем, и это насторожило: "would submit: undefined",

мой form.html:

<html>
<head>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="jquery.tokeninput.js"></script>
<link rel="stylesheet" href="token-input-facebook.css" type="text/css" />
<script type="text/javascript">
$(document).ready(function() {
$("input[type=button]").click(function () {
alert("Would submit: " + $(this).siblings("input[type=text]").val());
});
});
</script>

</head>
<body>
<form action="process.php" method="post">

<label for="title" class="control-label col-sm-2">Title(s) :</label>
<input name="title" id="title" class="form-control">
<input type="button" value="Submit" />
<script type="text/javascript">
$(document).ready(function() {
$("#title").tokenInput("gethint.php", {
theme: "facebook",
hintText: "Begin typing title ...",
noResultsText: "No titlesfound",
propertyToSearch: "title",
tokenValue: "'id'",
tokenDelimiter: ","});
});
</script>
</form>

</body>
</html>

process.php:

<?php
$titles = $_POST["title"];
?>
<html>
<body>
<?php
print_r($names);
?>
</body>
</html>

0

Решение

Нет input[type=text]элементы в вашем HTML, как указано здесь:

alert("Would submit: " + $(this).siblings("input[type=text]").val());

Измените ваш HTML на:

<input type="text" name="title" id="title" class="form-control">
1

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]