zzheads
zzheads

Reputation: 1472

How reload src element

How to force browser reload single element of the page ('src' in my case, or 'div', no matter)? Using this code:

$("div#imgAppendHere").html("<img id=\"img\" src=\"/photos/" + recipe.id + ".png\" height=\"60px\"/>");

It changes page source, but not reload changed element. How to do it? Thanks in advance.

Upvotes: 0

Views: 101

Answers (1)

zzheads
zzheads

Reputation: 1472

Patrick Evans, you right, that hack is works. So my code is:

var someRandQuery = "?" + (Math.random()*100000);
$("#imgAppendHere").html("<img id=\"img\" src=\"/photos/" + recipeId + ".png" + someRandQuery + "\" height=\"60px\"/>");

Upvotes: 1

Related Questions