I have a problem with the following JavaScript function:
function blablabla(str) {
if (window.XMLHttpRequest) {
// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp_move = new XMLHttpRequest();
} else {
// code for IE6, IE5
xmlhttp_move = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp_move.onreadystatechange = function() {
if (xmlhttp_move.readyState == 4 && xmlhttp_move.status == 200) {
document.getElementById("inventory").innerHTML = xmlhttp_move.responseText;
}
}
xmlhttp_move.open("GET","/m/inventory.php?id="+str,true);
xmlhttp_move.send();
}
When user clicks too many times non-stop, without waiting reload at some point he sees website crash (i mean styling changes.. as I guess function returns empty result into DIV) which is the smart way to fix this problem? I've read some articles about using open(.., false) but i'd like to keep asynchronized function.