DropzoneJS: How to get PHP response after upload success?
Looking at your website, seems like you were able to fix the problem.
Anyways this is for someone who might still be looking. You need to add the function success with two parameters. The first param returned is always file, second one is the response.
One of the other answers had this, but this response did not initially include it. It's important to set the autoDiscover to false, or this example (as provided in the docs) does not work. Tested on Chrome/IE/Edge on Win10.
Sample:
Dropzone.autoDiscover = false;
$(function() {
Dropzone.options.uiDZResume = {
success: function(file, response){
alert(response);
}
};
});
I had have some problems with dropzone, but i found this solution:
new Dropzone("#myDropzone", {
maxFilesize: 2, // MB
init: function() {
this.on("success", function(file, responseText) {
console.log(responseText);
});
}
});
The valided answer not worked for me. This does :
$(".mydrop").dropzone({
url: upload_url,
success : function(file, response){
console.log(file);
console.log(response);
}
});
And in the php side:
echo json_encode($whateverouwant);
die();