jquery döngü konusunda yardım
3
●60
- 03-09-2022, 16:32:38
$(".order-status-modal").each(function(e) { var $data_id = $(this).data("content"); $("#form-status-" + $data_id).validate({ lang: "tr", rules: {}, submitHandler: function (form, e) { e.preventDefault(); $.ajax({ url: "<?= $this->adminURL . '/orders/updateOrderStatus' ?>", type: "POST", data: new FormData(form), contentType: false, cache: false, processData: false, beforeSend: function() { Notiflix.Loading.Hourglass('Yükleniyor.. Lütfen bekleyiniz..'); }, success: function (data) { var data = JSON.parse(data); if (data.status == "error"){ setTimeout(function () { Notiflix.Loading.Remove(); Notiflix.Notify.Failure(data.message); setTimeout(function () { location.reload(); }, 1500) }, 1000); } else { $("#form-status-" + $data_id)[0].reset(); $('#order-status-modal-' + $data_id).modal('hide'); setTimeout(function () { Notiflix.Loading.Remove(); Notiflix.Notify.Success(data.message); setTimeout(function () { location.reload(); }, 1500) }, 1000); } }, error: (error) => { console.log(JSON.stringify(error)); } }); } }); });Örnek bir kod attım, kendine göre revize edebilirsin. - 03-09-2022, 16:52:23
var elem = document.getElementById('the-span'); var dataId = elem.getAttribute('data-id');