【问题标题】:ajax working in chrome not firefoxajax在chrome而不是firefox中工作
【发布时间】:2012-01-28 16:40:53
【问题描述】:

喂,

我的 ajax 代码在 Chrome 中可以正常工作,但在 Firefox 中却不行。 我有一个生成验证码图像的 php 脚本,我通过 javascript 和 ajax 验证它。 如果用户在firefox中插入正确的代码,脚本返回1,如果用户插入错误的代码,脚本返回0并改变图片,如果用户再次插入错误的代码,脚本返回0但不改变图片(在 Firefox 中,在 chrome 中每次都可以正常工作)

 $("#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>')  ;
                            }
                          }

                        });


        });

【问题讨论】:

  • 可能是 Firefox 正在缓存数据。尝试在您的网址中添加一个随机的否。比如 include/scripts/validation.php?rand=29994 或 CaptchaSecurityImages.php?rand=234324
  • 它工作了,我错过了一个“但现在它工作了,非常感谢你
  • 非常感谢@Jashwant,真的帮了我很多。

标签: ajax firefox google-chrome


【解决方案1】:

Firefox 似乎将其存储在缓存中。 通过添加 rand 解决了它。

【讨论】:

    猜你喜欢
    • 2016-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-05
    • 2016-01-18
    • 2016-02-05
    • 2010-12-27
    • 2010-09-21
    相关资源
    最近更新 更多