Why I get: Uncaught SyntaxError: Unexpected ILLEGAL token here

I have this simple script:

ids="22656" url = "http://api.stackoverflow.com/1.0/users/"+ids+"/timeline"; console.log( url ); xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET", url ,true); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { console.log( xmlhttp.responseText ); } xmlhttp.send( null ); }; 

But I do not quite understand why I get:

 Uncaught SyntaxError: Unexpected token ILLEGAL 

Can someone shed some light on this?

+4
source share
1 answer

The quotes around the GET are not correct. You must use standard single or double quotes for strings.

+10
source

Source: https://habr.com/ru/post/1342034/


All Articles