Insert data in mysql even if there is no image with dropzone js

Viewed 48

(Excuse me but i am french)

I am inserting all of my form data as well as images into my mysql table using dropzone JS and it works fine.

But if you don't select an image, the data is not saved.

I proceed in this way but nothing happens. Thank you for your help

if ($("#divDropzone").html().length != 0) {
  myDropzone.processQueue();
  e.preventDefault();
  e.stopPropagation();
} else {
  insertDemande();
}

function insertDemande() {
  $.ajax({
    url: 'insertDemande.php',
    type: 'POST',
    data: $('#frmDemande').serialize(),
  }).done(function() {
    $("#frmDemande").hide();
    $("#demandeOk").removeClass("d-none");
    $("#demandeOk").addClass("d-block");
  });
}
0 Answers
Related