Ajax Refresh an Image in Mozilla Firefox

I use Ajax reload an captcha code image.

$('.load_captcha').click(function(){
    var formData = {

        // CSRF token
        _token          : csrf_token 
    };
    $.ajax({

        // The URL where we want to POST
        url     : captcha_url, 

        // Define the type of HTTP verb we want to use (POST for our form)
        type    : "POST", 

        data    : formData
    }).done(function(data) {

        // Here we will handle errors and validation messages
        if (data.success) {

            // Handle errors
            $('.captcha_img').replaceWith(data.captcha);
        } else { 
            // ...
        }
    });
});
/**
 * View: postCaptcha
 * @return Response
 */
public function postCaptcha()
{
    return Response::json(
        array(
            'success'   => true,
            'captcha'   => HTML::image(URL::to('simplecaptcha'), 'Captcha', array('class' => 'captcha_img'))
        )
    );
}

It works well in Safari, Chrome and IE, but when I try it in Firefox, it doesn't work. And now, I know how to make it works, just add dynamic params of images file name, such as timestamp.

/**
 * View: postCaptcha
 * @return Response
 */
public function postCaptcha()
{
    return Response::json(
        array(
            'success'   => true,
            'captcha'   => HTML::image(URL::to('simplecaptcha'. '?' . time()), 'Captcha', array('class' => 'captcha_img'))
        )
    );
}
0.00 avg. rating (0% score) - 0 votes