document.querySelector('#result_form').innerHTML = response;
document.querySelector('#qwerty').innerHTML = response;
$(function () {
$("#ajax_form").submit(
async function(event) {
var form = new FormData(event.target);
event.preventDefault();
try {
var response = await $.ajax({
url: 'create-article.php',
type: 'POST',
data: form,
processData: false,
contentType: false
});
document.querySelector('#qwerty').innerHTML = response;
console.log("Ответ серввера:\n" + response);
}
catch(err) {
alert('Ошибка отправки, детали см. в консоли!');
console.log('Не удалось отправить форму:');
console.error(err);
}
}
);
});
document.querySelector('iframe').contentWindow.document.querySelector('.recaptcha-checkbox-borderAnimation').click();
async function sendForm() {
// Получаем элемент с формой, которую нужно отправить:
var form_element = document.querySelector('form#alfa');
// Создаем новую форму в конструкторе:
var form_data = new FormData(form_element);
// Добавляем к созданной форме аудио из блоба:
form_data.append('audio', blob, 'AudioName.wav')
// Отправляем форму на сервер без перезагрузки текущей страницы:
var response = await (await fetch('https://yousite.ru/handler.php', {
method: 'POST',
body: form_data
})).text();
// Выводим ответ сервера в консоли:
console.log("Ответ сервера: " + response);
}