2012-09-04 79 views
1

你好我长时间使用我的长轮询代码,它与jquery verison 1.8工作正常,但因为我升级到版本1.8.1它停止工作,它的给予我的错误setTimeout无法正常工作后,更新到jquery版本1.8.1

Error: NS_ERROR_XPC_BAD_CONVERT_JS: Could not convert JavaScript argument arg 0 [nsIDOMWindow.getComputedStyle]

这是我的代码

(function pollfrnd() { setTimeout(function() { 
     var demon=$('.frndnotimore').val(); 
     var page="notirequest"; 
     var a=$('.gvpgvpxgvp').val(); 
     $.ajax({ url: 'modules/notifications/beast.php?nid='+demon+'&id='+a+'&page='+page, 
     success: function(html) { 
     if ($.trim(html) == 'no') 
     { 

     } 
     else 
     { 

     $('.frndnotimore').remove(); 
     $('.notiloadfriend').prepend($(html).fadeIn('slow')); 
     counter(a,page); 
     } 
     }, dataType: "html", complete: pollfrnd }); }, 60000); })(); 

    }); 
+0

请不要为[错误搜索结果](https://www.google.co.uk/search?q=NS_ERROR_XPC_BAD_CONVERT_JS)导致您找到解决方案吗? – Jamiec

+0

nope,我第一次尝试它在谷歌,但仍然没有帮助,所以我在这里寻求帮助 –

+0

当你从'beast.php'获取数据时,HTML的样子是什么?另外,'counter(a,page)'是做什么的?任何进一步的DOM操作? – Jamiec

回答

1

当我下面正好运行你的代码,我没有错误可言实际上(jQuery的1.7.2和jQuery 1.8.1和Firefox的EVEN 14),它甚至试图轮询一些东西:

function pollfrnd() { setTimeout(function() { 
     var demon=$('.frndnotimore').val(); 
     var page="notirequest"; 
     var a=$('.gvpgvpxgvp').val(); 
     $.ajax({ url: 'modules/notifications/beast.php?nid='+demon+'&id='+a+'&page='+page, 
     success: function(html) { 
     if ($.trim(html) == 'no') 
     { 

     } 
     else 
     { 

     $('.frndnotimore').remove(); 

     $('.notiloadfriend').prepend(html); 
     //This code below was your problem in Firefox 
     //$('.notiloadfriend').prepend($(html).fadeIn('slow')); 
     counter(a,page); 
     } 
     }, dataType: "html", complete: pollfrnd }); }, 60000); } 

pollfrnd(); 
+0

请记住,使用$('。notiloadfriend')。prepend(html);不是你说的那个动画,而是$('。notiloadfriend')。prepend($(html).fadeIn('slow'));以避免你在你的问题中描述的奇怪错误只发生在Firefox中 – sajawikio