lundi 11 juillet 2016

Empty formData on IE10/11/Edge jQuery


Hello I have such code which works great on every browsers except Internet Explorer 10/11 and Edge.

$(this).on('submit', '.modal-form', function(event) {
    var $form = $(this);
    var $target = $($form.attr('data-target'));
    var $formData = new FormData(this);

    if(event.handled !== true) {
        $.ajax({
            headers: {'X-CSRF-TOKEN': $(this).find('input[name=_token]').val() },
            type: $form.attr('method'),
            url: $form.attr('action'),
            data: $formData,
            processData: false,
            contentType: false,

          success: function(data, status) {
                console.log("success");
          }
        });
        event.handled = true;
    }
    event.preventDefault();
});

I'm using it to post forms in ajax modal windows on my systems. But on Microsoft browsers formData is empty. On server side all inputs are missing. I'm using jQuery 1.11.3


Aucun commentaire:

Enregistrer un commentaire