2012-09-04 32 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