How to refresh the src of

前端 未结 4 1959
小鲜肉
小鲜肉 2020-12-03 01:30

where test.php generates an image with a random number.

Itried :

$(\'#verifyimage\').click(f         


        
4条回答
  •  旧时难觅i
    2020-12-03 01:59

    You can force a refresh by appending a random string at the end, thus changing the URL:

    $('#verifyimage').click(function() {
        $(this).attr('src', $(this).attr('src')+'?'+Math.random());
    });
    

提交回复
热议问题