Upload image with Ajax and PHP

后端 未结 1 1500
闹比i
闹比i 2021-01-28 14:25

I want to upload an image to my server, and control the PHP echos in my HTML code. To do this I want to use jQuery Ajax, but I don\'t know how to send the image with Ajax to PHP

相关标签:
1条回答
  • 2021-01-28 14:33
    $(".form").submit(function(){
        $.ajax({
                url: 'core/ctrlAdmin.php?prodInBD',
                type: 'POST',
                async: false,
                data: new FormData(this);
                success: function(respuesta){
    
                      /*   RECIVE HERE THE PHP ECHO         */
    
                }
        });
    });
    
    0 讨论(0)
提交回复
热议问题