我想發送新的排序有序數組到我的ajax文件。Dropzone排序數組發送到ajax文件
我使用jQuery UI的排序我想排序數組我auction.ajax.php文件後,排序的順序。
你可以看到我也試着準備一個數組。我需要將重新排序的文件名稱數組發送到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
重新排序後我想用逗號分隔重新排列的數組。 –