我有以下功能:
$('#userfile').change(function() {
$.ajaxFileUpload({
url: 'control/upload/go',
secureuri: false,
fileElementId: 'userfile',
dataType: 'json',
success: function(data, status) {
if(data.status != 'error') {
$('.input_response').val(data.filename);
}
$('.response').text(data.msg);
}
});
});
问题是如果没有完整的页面刷新,它将不会多次触发。
有什么想法吗?感谢
答案 0 :(得分:1)
修正了使用$(document).on(); - http://api.jquery.com/on/
答案 1 :(得分:0)
请尝试使用以下代码:
jQuery('#userfile').live('change', function()
{
jQuery.ajaxFileUpload({
url: 'control/upload/go',
secureuri: false,
fileElementId: 'userfile',
dataType: 'json',
success: function(data, status) {
if(data.status != 'error') {
jQuery('.input_response').val(data.filename);
}
jQuery('.response').text(data.msg);
}
});
});