新しいソート順配列をajaxファイルに送信しようとしています。Dropzoneソート済み配列をAjaxファイルに送信
私はauction.ajax.phpファイルにソートされた配列を取得したいのソート後の順序を並べ替えるためのjQuery UIを使用しています。
私も配列を準備しようとしています。私は再注文されたファイル名の配列をajaxページに送る必要があります。
<script>
$(document).ready(function(e) {
var imageNames = [];
$(function() {
$("#myDrop").sortable({
items: '.dz-preview',
cursor: 'move',
opacity: 0.5,
containment: '#myDrop',
distance: 20,
tolerance: 'pointer',
});
$("#myDrop").disableSelection();
});
//Dropzone script
Dropzone.autoDiscover = false;
var myDropzone = new Dropzone("div#myDrop", {
paramName: "files", // The name that will be used to transfer the file
addRemoveLinks: true,
uploadMultiple: true,
autoProcessQueue: false,
parallelUploads: 50,
maxFilesize: 2, // MB
acceptedFiles: ".png, .jpeg, .jpg, .gif",
url: "ajax/actions.ajax.php",
});
/*Ans code*/
myDropzone.on("sending", function(file, xhr, formData) {
var filenames = [];
$('.dz-preview .dz-filename').each(function() {
filenames.push($(this).find('span').text());
});
formData.append('filenames', filenames);
});
/* Add Files Script*/
myDropzone.on("success", function(file, message) {
$("#msg").html(message);
//setTimeout(function(){window.location.href="index.php"},800);
});
myDropzone.on("error", function(data) {
$("#msg").html('<div class="alert alert-danger">There is some thing wrong, Please try again!</div>');
});
myDropzone.on("complete", function(file) {
//myDropzone.removeFile(file);
});
$("#add_file").on("click", function() {
myDropzone.processQueue();
});
});
</script>
<div class="dropzone dz-clickable" id="myDrop">
<div class="dz-default dz-message" data-dz-message="">
<span>Drop files here to upload</span>
</div>
</div>
<input type="text" name="sortingOrder" id="sortingOrder" value="">
<button id="add_file">Add</button>
問題の説明は表示されません。あなたはどんな問題に直面していますか? – Rei
並べ替え後カンマ区切りで並べ替えられた配列を取得したいと思います。 –