DropzoneJS: How to get PHP response after upload success?

前端 未结 6 1594
粉色の甜心
粉色の甜心 2020-12-29 01:53

I\'m trying to implement Dropzone on my site. I want to listen for the \"success\" event and then take the server response and add some info from it to a form on the same pa

6条回答
  •  别那么骄傲
    2020-12-29 02:13

    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);
                }
            };
        });
    

提交回复
热议问题