@danchiksux
Говнокодер

Не работает ajax запрос в Mozilla, как исправить?

jquery-3.2.1.min
Есть код для отправки формы вопроса:
HTML:
<div id="fin">
		<div id="finO">
			<p></p>
			<button class="closefin" type="button">Закрыть</button>
		</div>
	</div>
<form id="formabout" method="POST">
	<p><input placeholder="Имя" required id="aname" type="text" name="name"></p>
	<p><input placeholder="Электронная почта" required id="amail" type="email" name="email"></p>
	<p><textarea placeholder="Вопрос" required id="atext" name="text"></textarea></p>
	<button type="button" id="addabout" name="abut">Задать вопрос</button>
	<div class="infp"></div>
</form>

PHP:
<?php
require '../libs/bd.php';
$date = $_POST;
if (isset($date['name']) and isset($date['email']) and $date['text']) {
	$name = $date['name'];
	$text = $date['text'];
	$email = $date['email'];
	$abres = mysqli_query($connection, "INSERT INTO `about`(`name`, `text`, `email`) VALUES ('$name', '$text', '$email')");
	if ($abres == true) {
		$fin = "Сообщение отправлено!";
	}

}
?>

JQuery:
function funcSucc(date) {
		$('#fin').fadeIn();
		$('#finO p').text('Вопрос успешно отправлен!')
	};

	$('#addabout').click(function() {
		var name = $('#aname').val();
		var email = $('#amail').val();
		var text = $('#atext').val();
		if (text == '' || email == '' || name == '') {
			$('#fin').fadeIn();
			$('#finO p').css({"color": "#f23232"})
			$('#finO p').text('Вопрос не отправлен! Заполните все поля.')
		} else {
			$.ajax ({
			url: "/script/about.php",
			type: "POST",
			data: ({name, email, text}),
			dataType: "text",
			success: funcSucc
			});
		};
	});

Проблема в том что в гугле всё отправляется а в мозилле нет...
В других браузерах не тестил.
  • Вопрос задан
  • 98 просмотров
Решения вопроса 1
Stimulate
@Stimulate
могу
$('#addabout').click(function(event) {
    event.preventDefault();
...
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы