the object calls this function, as usual. What happens? The function take this third parameter, which should change an attribute of the object, what not procced. Anybody could enlight?
function insertbean(post_id, ip, imgcgn) {
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("bn"+post_id).innerHTML = this.responseText;
}
};
request.open("GET", "incrbean.php?postid="+post_id+"&ip="+ip, true);
request.send();
if(imgcgn){
document.getElementById("lmp"+post_id).src = "SVG/lampsmall.svg";
document.getElementById("lmp"+post_id).onclick = "insertbean("+post_id+", "+ip+", false)";
}
else {
document.getElementById("lmp"+post_id).src = "SVG/lamponsmall.svg";
document.getElementById("lmp"+post_id).onclick = "insertbean("+post_id+", "+ip+", true)";
}
<button onclick="insertbean($post_id, $ip, true)">Clickme!</button>
Seemly everything is right, the files just exists in the folder and so on, that's why i'm so curious to know.
THanks.