load Same Picture Without cache
<div id="dialog">
<img src="NewCapthch.jpg" id="imgcaptcha"/>
</div>
<input id="Submit1" onclick ="dial();" type="submit" value="submit" />
function dial(){
开发者_JAVA技巧 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()
};
what does not change image?
I think load From Cache.
Simple mistake, change "NewCapthch.jpg?id" to "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()
};
Guess you should wrap the 2nd and 3rd call insinde the callback function off jQuery.get
function dial() {
jQuery.get("Captch.aspx?id=" + Math.random(), function () {
$("#imgcaptcha").attr("src", "NewCapthch.jpg?id" + Math.random());
$("#dialog").dialog();
});
}
精彩评论