I'm calling a function like this:
<img src="/images/icons/info.png"
width="18" height="18" class="iconbutton" alt="Add to Library"
onclick="AddLibrary(12345,this.id); this.onclick=null;" />
The function then POSTS 12345 to another script and then is supposed to change the icon image:
function AddLibrary(pibnval,thisid) {
$.post('/addlibrary.php', {
pibn: pibnval
}, function() {
thisid.setAttribute('src', "/images/icons/tick.png");
});
};
The POST works great, but the image does not change.
I also tried:
document.getElementById(thisid).src = "/images/icons/tick.png";
but that didn't work either.
Any ideas?
idof yourimgtag that you are passing to the function?