0
다음 코드를 사용하여 ID를 기반으로 테이블 행을 정렬합니다. 드래그 앤 드롭 기능을 위해 Dragula를 사용하고 있습니다. 정렬 된 ID는 sortedIDs 변수에 표시됩니다. if (sortedIDs)가 경고를 표시하지만 AJAX를 사용하여 요청을 보내지 않는 경우 경고가 나타납니다.Dragula가 AJAX 요청을 보내지 않습니다.
var container = document.getElementById('tb');
var rows = container.children;
var nodeListForEach = function (array, callback, scope) {
for (var i = 0; i < array.length; i++) {
callback.call(scope, i, array[i]);
}
};
var sortableTable = dragula([container]);
var pingu='';
sortableTable.on('dragend', function() {
nodeListForEach(rows, function (index, row) {
//alert(row.id);
pingu=pingu+','+row.id;
//alert(pingu);
// row.lastElementChild.textContent = index + 1;
// row.dataset.rowPosition = index + 1;
});
var sortedIDs=pingu;
pingu='';
// alert (sortedIDs);
if (sortedIDs) {
alert(sortedIDs);
$.ajax({
type: 'GET',
url: '<?php echo $site_url . 'index.php/API/p2376ghDSPOLWYBdhBT'?>',
data: 'lmqSPOEhyVt87H6tBYSfdreg=' + sortedIDs + '&hjhqweuty87685gh87GCfsc6HF=' + sbds98JWUDGHKJ98yujg,
success: function (tata) {
alert (tata);
if (tata == '1') {
$("#success").show();
$('#success').delay(2000).fadeOut('slow');
} else {
$("#failure").show();
$('#failure').delay(5000).fadeOut('slow');
}
}
});
} else {
//$('#ms').html('<option value="">Select Q level first</option>');
}
});
그리고 내가 AJAX 오류를 보여주는
error : function(jqXHR, textStatus, errorThrown){
}
를 추가하고, 너무 경고를 던지기 시작합니다.
모든 종류의 도움을 주시면 감사하겠습니다. 감사합니다.