[英]jQuery Fileupload Blueimp on AJAX input
After fighting this plugin for hours, I still cannot get it to work. 经过数小时的工作,我仍然无法正常工作。 It is one problem after another, and I have no idea what I'm doing wrong if anything!
这是一个接一个的问题,我不知道自己在做什么错!
I am working on ASP.NET MVC application, and have a partial view that contains the file input. 我正在使用ASP.NET MVC应用程序,并且有一个包含文件输入的局部视图。 On initial page load, the input does not exist in the DOM, it only comes through via an AJAX call when I press a button.
在初始页面加载时,输入不存在于DOM中,仅当我按下按钮时才通过AJAX调用来输入。
So here is my code and a related thread of mine about this issue. 因此,这是我的代码以及与此问题相关的主题 。
$(function () {
$('#campaign-form-wrap').on('change', '#fileUpload', function () {
$(this).fileupload({
dataType: 'json',
url: '/JWIntranet/Campaign/ConvertExcelToVehicleDriverSummariesJson',
done: function (e, data) {
$.each(data.result.files, function (index, file) {
$('<p/>').text(file.name).appendTo(document.body);
});
}
});
});
});
This code does not throw any errors, so I guess all is good! 这段代码不会引发任何错误,所以我想一切都很好! (read linked thread for details).
(有关详细信息,请参阅链接的线程)。
However, the plugin is NOT working in the sense that the break-point on my MVC controller is not being hit. 但是,该插件在未达到我的MVC控制器上的断点的意义上无法正常工作。
Anyone any ideas on this? 有人对此有任何想法吗? it is driving me mad :(
它让我发疯了:(
Your event delegation seems strange. 您的活动代表团似乎很奇怪。 Maybe it's because I haven't your view code, but you can just try it :
也许是因为我没有您的视图代码,但是您可以尝试一下:
$(function () {
$('#campaign-form-wrap').on('fileuploadadd', function () {
dataType: 'json',
url: ... ,
done: function (e, data) {
...
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.