猿问

Chrome浏览器不能连续上传相同的图片,第二次无请求,页面采用jquery.form.js

html:

<form id="uploadForm">

    <input id="img" class="hidden" type="file" name="file" />

</form>

脚本:

$('#uploadForm').ajaxSubmit({

    url: '……',

    type: 'post',

    async: true,

    cache: false,

    dataType: 'json',

    contentType: 'multipart/form-data',

    beforeSend: function(){//发送前

                

    },

    complete: function(){//发送后

                

    },

    success: function(data){//请求成功

                 

    },

    error: function(response, textStatus, errorThrown){//请求失败

                 

    }

});


米脂
浏览 633回答 1
1回答

摇曳的蔷薇

你需要在完成时,重置表单,在请求成功之后 加入$('input[type=file]').wrap('<form>').closest('form').get(0).reset();
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答