javascript unexpected identifier
javascript unexpected identifier
Yes, you have a }
too many. Anyway, compressing yourself tends to result in errors.
function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById(content).innerHTML = xmlhttp.responseText;
}
} // <-- end function?
xmlhttp.open(GET, data/ + id + .html, true);
xmlhttp.send();
}
Use Closure Compiler instead.
I recommend using http://jsbeautifier.org/ – if you paste your code snippet into it and press beautify, the error is immediately visible.
javascript unexpected identifier
In such cases, you are better off re-adding the whitespace which makes the syntax error immediate apparent:
function(){
if(xmlhttp.readyState==4&&xmlhttp.status==200){
document.getElementById(content).innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open(GET,data/+id+.html,true);xmlhttp.send();
}
Theres a } too many. Also, after the closing } of the function, you should add a ; before the xmlhttp.open()
And finally, I dont see what that anonymous function does up there. Its never executed or referenced. Are you sure you pasted the correct code?