weixin_33690963 2015-12-25 17:07 采纳率: 0%
浏览 13

重复的ajax响应

When I'm uploading a file I make an AJAX request:

    $(function () {
        $.ajax({
            async: true,
            url: "../public/currentfile",                   
            dataType: 'json',
            method:'get',
            success: function(data) {
                console.log(data); 
                var created_at = data['created_at'];
                var filesize = data['filesize'];
                var filename = data['filename'];
                var fileid = data['fileid'];
                $("#results .toBeSelected").prepend("<tr class='tabledata'><td>" + fileid + "</td><td>" + filename + "</td><td>" + filesize + "</td><td>" + created_at + "</td></tr>");
            }                    
        });
    });

I get the filesize, filename and so on and pass them to the browser. Everything's ok when I upload a single file. But when I upload more than 5 files at once, some of the responses are duplicate.

What is wrong? Is this a wrong practice?

  • 写回答

0条回答 默认 最新

    报告相同问题?