2012-01-28 87 views
0

Hy,阿賈克斯工作在鉻不火狐

我有這個AJAX代碼,在Chrome中工作正常,但在Firefox中沒有。 我有一個生成驗證碼圖像的php腳本,我通過javascript和ajax驗證它。 如果用戶在firefox中插入正確的代碼,則腳本返回1,如果用戶插入錯誤的代碼,則腳本返回0並更改圖片,如果用戶再次插入錯誤代碼,則腳本返回0,但不會更改圖片(在Firefox中,鉻在每次都能正常工作)

$("#finish").click(function() { 
      //$(function() { 
        var text = $("#captchaText").val(); 
        //alert(text); 
        //var session = $("#captchaText2").val(); 
        //alert(session); 
        $.ajax({ 
          //type: 'POST', 
          url: 'includes/scripts/validation.php', 
          data: 'id='+text, 

          success: function(response){ 
          alert(response); 
          if(response == 0){ 
            $('#poza').html('<p><img src="includes/scripts/CaptchaSecurityImages.php" /></p>') ; 
          } 
          } 

         }); 


     }); 
+1

可能是Firefox正在緩存數據。 嘗試在你的網址中添加一個隨機號碼。 等包括/腳本/ validation.php?蘭特= 29994 或CaptchaSecurityImages.php?蘭特= 234324 – Jashwant 2012-01-28 16:48:23

+0

它的工作我錯過了「,但現在它的作品,非常感謝你的[停止jQuery的從.load響應 – Razvan 2012-01-28 16:53:38

+0

可能重複被緩存](http://stackoverflow.com/questions/168963/stop-jquery-load-response-from-being-cached) – 2012-04-05 16:02:24

回答

2

看來,Firefox將它存儲在緩存中。 通過添加一個蘭德解決它。