<script>
$("input[name='siparisGrafiker']").on("dblclick", function () {
let bid = $(this).data("id")
Swal.fire({
title: "Not Girişi",
text: "Grafiker için not yazabilirsiniz!",
input: 'textarea',
showCancelButton: true,
cancelButtonText: 'İptal',
confirmButtonText: 'Kaydet',
showLoaderOnConfirm: true,
allowOutsideClick: () => !Swal.isLoading(),
preConfirm(inputValue) {
return $.ajax('islem.php', {
type: "POST",
dataType: "json",
data:{
not: inputValue,
grfnot: bid // id değerini de bir post parametresi olarak gönderdim, isterseniz yine url nin sonuna ekleyebilirsiniz
}
})
},
inputValidator(inputValue) {
if (!inputValue) {
return 'Boş not gönderemezsiniz!'
}
}
}).then((e) => {
if (e.isConfirmed) {
if (e.value.status) { // Eğer sunucudan gelen JSON FORMATINDAKİ yanıtın status değeri true ise, yani arka taraftaki işlem başarılı olmuşsa
/*new PNotify({
title: 'Tebrikler!',
text: 'Notunuz kaydedilmiştir',
type: 'success',
styling: 'bootstrap3',
delay: 6000,
icon:false
})*/
console.log('İşlem başarılı')
}
else {
// Başarılı olmamışsa yapılacak işlemler
console.log('İşlem başarısız')
}
}
})
})
</script>
// islem.php tarafı
if (isset($_POST['grfnot'])) { // Postu bu şekilde yakalayın
$id = $_POST['grfnot'];
$not = $_POST['not'];
// verileri işleyin
// Eğer işlem başarılı ise şu yanıtı döndürün
$response = [
'status' => true
];
// İşlem başarısız ise şu yanıtı döndürün
$response = [
'status' => false
];
// burada javascripte yanıt verin
echo json_encode($response);
}