(simple) return in if statement?
Code:
if(customer== ""){
document.getElementById('customerInfo').innerHTML = "";
return;
}
In this code, Why is the RETURN there? It doesn't work without the return, and it doesn't matter if i put return false, or return true.. (full code underneath)
Code:
function toonKlant(klantnaam){
if(klantnaam == ""){
document.getElementById('hint').innerHTML = "";
return;
}
if(window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
}
xmlhttp.onreadystatechange = function(){
if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
document.getElementById("hint").innerHTML = xmlhttp.responseText;
}
}
xmlhttp.open('GET','toonklant.php?name=', true);
xmlhttp.send();
}