Dropezone在运行时不处理拖动事件,但在调试时不处理

时间:2018-09-04 22:46:38

标签: javascript jquery ajax

嗨,我正在加载包含

的jstl jsp调色板

带有放置区的表单,可用于调用

servlet,下面的代码在我调试时起作用

,但运行时不显示

    // JavaScript Document
$(document).ready(function (e) {
$(document).on("click", '#ad_art', function (event) {
    var frmp = document.getElementById("submitarticle");
    frmp.submit(function (event) {
        event.preventDefault();
        event.stopPropagation();
        $.ajax({
            type: frmp.attr('method'),
            url: frmp.attr('action'),
            data: frmp.serialize(),
            dataType: 'text/html',
            success: function (data) {
                // replace the email form with thank you message
            },
            error: function (data, status, er) {
                alert("error: " + data + " status: " + status + " er:" + er);
            }
        })
                .done(function (response) {
                    $("#Tb_FenettrePrincipale").empty().append("<div class=\"Tb_FenettreSec\" id=\"_ADD\"><p>Ajout Article</p></div>");
                    $("#Tb_FenettrePrincipale").append("<div style=\"width:700px;padding:20px;S\">");
                    $("#Tb_FenettrePrincipale").append("<div id=\"ajout_article\" class=\"ajout_article\">");
                    $("#Tb_FenettrePrincipale").append("</div></div>");
                    $("#add").removeClass('current');
                    $("#ad_art").addClass('current');
                    $('#ajout_article.div').remove();
                    var form_particulier = $("<div/>");
                    form_particulier.load("Palettes/formInsArticle.jsp");
                    var formul = $("#ajout_article");
                    formul.append("<select name=\"type\" class=\"type\"><option>Propose</option><option>Cherche</option></select>");
                    formul.append(form_particulier);
                    $('#fileupload').fileupload();
                })
                .fail(function (jqXHR, status, error) {
                    // Triggered if response status code is NOT 200 (OK)
                    alert(jqXHR.responseText);
                })
                .always(function () {
                    // Always run after .done() or .fail()
                    $('p:first').after('<p>Thank you.</p>');
                });
    });
    return false;
});
$(document).on("click", '#add a', function (event)
{
    var ajoutArticle = new Object();
    ajoutArticle.intiale = 'ajout';

    $.ajax({
        url: "/Chtaybou/AjoutArtilcle",
        type: 'POST',
        dataType: 'json',
        data: JSON.stringify(ajoutArticle),
//        data: JSON.parse(compteVoip),

        contentType: 'application/json',
        mimeType: 'application/json',
        success: function (data) {

            constructform("insArt");
            preareDZ();

        },
        error: function (data, status, er) {
            alert("error: " + data + " status: " + status + " er:" + er);
        }
    });

    return false;
});
return false;

});

function constructform(param) {
var ajoutArticle = new Object();
ajoutArticle.intiale = param;

var principal = $("#Tb_FenettrePrincipale");
$("#Tb_FenettrePrincipale").empty().append("<div class=\"Gc_FenettreSec\" id=\"_ADD\"><p>Ajout Article</p></div>");
;
$("#Tb_FenettrePrincipale").append("<div style=\"width:700px;padding:20px;S\">");
$("#Tb_FenettrePrincipale").append("<div id=\"ajout_article\" class=\"ajout_article\">");
$("#Tb_FenettrePrincipale").append("</div></div>");
var add = $("#add");
$("#add").removeClass('current');
$("#ad_art").addClass('current');
$('#ajout_article.div').remove();
var form_particulier = $("<div/>");
form_particulier.load("Palettes/formInsArticle.jsp", ajoutArticle);
//form_particulier.html();
var formul = $("#ajout_article");
$("#ajout_article").append("<select name=\"type\" class=\"type\"><option>Propose</option><option>Cherche</option></select>");

$("#ajout_article").append(form_particulier);


}

function preareDZ() {

$('#fileupload').fileupload({
    done: function (e, data) {
        $("tr:has(td)").remove();
        $.each(data.result, function (index, file) {

            $("#uploaded-files").append(
                    $('<tr/>')
                    .append($('<td/>').text(file.fileSize))
                    .append($('<td/>').text(file.fileType))
                    .append($('<td/>').html("<a href='upload?f=" + index + "'>Click</a>"))
                    .append($('<td/>').text("@" + file.email))

                    )//end $("#uploaded-files").append()
        });
    },
    progressall: function (e, data) {
        var progress = parseInt(data.loaded / data.total * 100, 10);
        $('#progress .bar').css(
                'width',
                progress + '%'
                );
    },
    dropZone: $('#dropzone')
}).bind('fileuploadsubmit', function (e, data) {
    // The example input, doesn't have to be part of the upload form:
    var _email = $('#_email');
    var titre = $('#titre');
    data.formData = {_email: _email.val(), titre: titre.val()};
});

}
;

此代码用于调用servlet并获得响应

执行时,将加载表单,但是有

没有事件处理,没有名为I.E的事件

存在dropzone,但不响应

拖动事件

0 个答案:

没有答案