загрузить ту же картинку без кеша - PullRequest
0 голосов
/ 15 марта 2011
<div id="dialog">
    <img src="NewCapthch.jpg" id="imgcaptcha"/>
</div>

<input id="Submit1" onclick ="dial();" type="submit" value="submit" />

function dial(){
      jQuery.get("Captch.aspx?id=" + Math.random());//success run and get
      $("#imgcaptcha").attr("src", "NewCapthch.jpg?id="+Math.random());//dose not set new image
    $("#dialog").dialog()
};

что не меняет образ?

думаю загрузить From Cache.

Ответы [ 2 ]

1 голос
/ 15 марта 2011

Простая ошибка, замените "NewCapthch.jpg? Id" на "NewCapthch.jpg? Id ="

function dial(){
      jQuery.get("Captch.aspx?id=" + Math.random());//success run and get
      $("#imgcaptcha").attr("src", "NewCapthch.jpg?id="+Math.random());//dose not set new image
    $("#dialog").dialog()
};
0 голосов
/ 15 марта 2011

Думаю, вам следует заключить 2-й и 3-й вызов в функцию обратного вызова jQuery.get

        function dial() {
        jQuery.get("Captch.aspx?id=" + Math.random(), function () {
            $("#imgcaptcha").attr("src", "NewCapthch.jpg?id" + Math.random());
            $("#dialog").dialog();
        });
    }   
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...