【发布时间】:2015-07-21 11:52:41
【问题描述】:
我读到这个:https://github.com/enyo/dropzone/wiki/Set-URL-dynamically 但我没有成功... :( 我有 1 个表格...
我使用 ajax 发送输入。
ajax 返回用户的新 id。在这一刻,我想更改 de url dropzone 以将路径设置为新用户的 id。
$.ajax({
type: "POST",
url: "class/inserir.php?funcao=teste",
data: formdata,
dataType: "json",
success: function(json){
if(json.sucesso=="sim"){
alert("Wait! Sending Pictures.");
this.options.url = "class/upload_img.php?"+json.id;
myDropzone.processQueue();
}else{
location.href="home.php?ir=cad_animal&cad=nao&erro="+json.erro;
}
}
});
var myDropzone = new Dropzone("#imagens", {
url: "class/upload_imgteste.php",
paramName: "file", // The name that will be used to transfer the file
maxFilesize: 1, // MB
addRemoveLinks : true,
dictResponseError: "Não foi possível enviar o arquivo!",
autoProcessQueue: false,
thumbnailWidth: 138,
thumbnailHeight: 120,
});
对不起我的英语不好!
谢谢大家。
【问题讨论】:
标签: dropzone.js