<form id="myform" action="/misc/" method="post">
<div class="form-group">
<input type="text" class="form-control" placeholder="Имя" name="name">
</div>
<div class="form-group">
<input type="tel" class="form-control" placeholder="+79180000001" pattern="(\+?\d[- .]*){7,13}" name="phone">
</div>
<button type="submit" class="btn">Отправить</button>
</form>
$("#myform").submit(function(e) {
e.preventDefault();
let f = $("#myform").serialize()+'&t='+$('.ticket-type').attr('data-info')+'&k='+$('.ticket-count').html();
$.ajax({
url: '/message',
type: 'post',
dataType: 'json',
data: f,
success: function(data) {
console.log(data);
$('#myform')[0].reset();
},
error: function(data) {
console.log(data);
}
});
});
});
$name = htmlspecialchars($_POST["name"]);
$phone = htmlspecialchars($_POST["phone"]);
$t_id = htmlspecialchars($_POST["t"]);
$t_qt = htmlspecialchars($_POST["k"]);
const arr = [{
"text": "foo",
"delay" : "2000"
},
{
"text": "bar",
"delay" : "2000"
},
{
"text": "bar1",
"delay" : "5000"
},{
"text": "bar",
"delay" : "1000"
}
];
function timeout(val){
return new Promise((resolve, reject)=>{
setTimeout(()=>{
console.log(val.text);
resolve();
}, val.delay);
});
}
(async () => {
for (const val of arr) {
await timeout(val);
}
console.log('Расчет окончен');
})();
for (i in data) {
var row = data[i];
var emailAddress = row[0]; // First column
var message = row[1]; // Second column
var subject = "Sending emails from a Spreadsheet";
MailApp.sendEmail(emailAddress, subject, message);
}
$.ajax({ url: '/message',
Даже если в форм поставить урл "правильный"
Пусто