Firefox 中的 zclip 和 jquery ajax 问题
我知道它已经在关于能够使用 zclip 使用 ajax 复制并粘贴到剪贴板的各种主题中进行了介绍,但我想知道我的问题是否与 jquery、firefox 和 ajax 请求更普遍......
$("#generate-report-to-clipboard").zclip({
path: '/Content/ZeroClipboard.swf',
copy: function () {
var options = {
async: false, success: function (data) {
// now do ajax call for report results
$.ajax({
url: '<%= Url.Action("GenerateEmailToClipboard") %>',
type: 'POST',
async: false,
success: function (data, status) {
$("#copy-holder").text(data);
}
});
}
};
$("#report-definition-form").ajaxForm(options);
$("#report-definition-form").submit();
return $("#copy-holder").text();
}, afterCopy: function () { alert('something'); }
});
好吧,所以我的想法是,当我单击链接时,我会请求复制数据,并在成功后将该数据添加到剪贴板。
这个方法在 IE 8(我知道很奇怪)和 Chrome 12 中工作正常,但在 Firefox 4 中不行。
我认为它可能与 AJAX 请求有关的原因是当我删除 AJAX 调用并将 #copy-holder 设置为值,它复制到剪贴板没有问题。
请帮忙,我要疯了!
I know its been covered in various topics about being able to use zclip to copy and paste to the clipboard using ajax, but I'm wondering if my issue is something a bit more general with jquery, firefox and ajax requests...
$("#generate-report-to-clipboard").zclip({
path: '/Content/ZeroClipboard.swf',
copy: function () {
var options = {
async: false, success: function (data) {
// now do ajax call for report results
$.ajax({
url: '<%= Url.Action("GenerateEmailToClipboard") %>',
type: 'POST',
async: false,
success: function (data, status) {
$("#copy-holder").text(data);
}
});
}
};
$("#report-definition-form").ajaxForm(options);
$("#report-definition-form").submit();
return $("#copy-holder").text();
}, afterCopy: function () { alert('something'); }
});
Ok, so the idea is when I click the link, I go and request the data to copy and on success add that data to the clipboard.
This method works fine in IE 8 (strange I know) and Chrome 12 but not in Firefox 4.
The reason I think it might have something to do with the AJAX request is when I remove the AJAX call and set #copy-holder to a value, it copies to the clipboard with no problem.
Please help, I'm going mad!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现 Firefox 中 AJAX 调用的数量很奇怪。我有一个弹出窗口,允许用户复制,然后转到下一个对象,打开弹出窗口并复制。在Chrome、IE等中,AJAX请求是单个请求,因此可以返回结果,但在Firefox中,AJAX请求有多个。一个对应于用户单击的每个弹出窗口。
问题是实际的 jquery.jzclip.js 文件,第二个、第三个..请求正从该文件传回 AJAX 函数,就像您一样。如果您使用控制台(F12),您可以看到它的发生。目前还没有解决方案,尝试对给出的 js 文件进行故障排除非常烦人。
I've found the number of AJAX calls to be strange in Firefox. I have a pop-up window that allows the user to copy, then go to the next object, open the pop-up and copy. In Chrome, IE, etc the AJAX requests are a single one and therefore the result can be returned, but in Firefox there numerous AJAX requests. One for each pop-up window the user clicked on.
The problem is the actual jquery.jzclip.js file, the 2nd,3rd.. requests are being passed back from this file into the AJAX function like you have. If you use the console(F12) you can see it happening. No solution to this yet, it's pretty damn annoying trying to troubleshoot the js file that was given.