0

Hy ,

I have this ajax code that works fine in Chrome but in Firefox does not. I have a php script that generates a captcha code image , i verify it through javascript and ajax. If the user inserts the correct code in firefox the scripts returns 1 , if the user insert the wrong code the script returns 0 and changes the picture , if the user inserts again the wrong code the script returns 0 but it does not change the picture (In firefox , in chrome works fine everytime)

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

                        });


        });
Razvan
  • 710
  • 3
  • 9
  • 25
  • 1
    May be firefox is caching data. try adding a random no in your url. like includes/scripts/validation.php?rand=29994 or CaptchaSecurityImages.php?rand=234324 – Jashwant Jan 28 '12 at 16:48
  • it worked i missed a " but now it works , thank you very much – Razvan Jan 28 '12 at 16:53
  • possible duplicate of [Stop jQuery .load response from being cached](http://stackoverflow.com/questions/168963/stop-jquery-load-response-from-being-cached) – Rob W Apr 05 '12 at 16:02

1 Answers1

2

It appears that firefox stores it in cache. By adding a rand solved it.

Razvan
  • 710
  • 3
  • 9
  • 25