I have this code that will print a link, but where are this symbol "\" what can't print with JS.
document.getElementById('menu_links').innerHTML+="<li><a
href='CRUD\data.php'>Data</a></li>";
I have this code that will print a link, but where are this symbol "\" what can't print with JS.
document.getElementById('menu_links').innerHTML+="<li><a
href='CRUD\data.php'>Data</a></li>";
The '\'
character is an escape character, it needs to be escaped to be printed like:
console.log('\\');
Will print '\'
Just escape the character with another \
document.getElementById('menu_links').innerHTML+="<li><a href='CRUD\\data.php'>Data</a><\li>";
console.log('CRUD\\data.php'); //print path
<span id="menu_links"></span>
Edit: always use forward slash for URLs like http://example.com/CRUD/data.php
, that way you wont have this problem and the code will be compatible across browsers.