I have a JavaScript variable that I echo out using PHP which is shown like this in the page source:
var db_1 = \'C:\\this\\path\';
When I s
A backslash is an escape character in JS. They are lost when the string literal is parsed.
You can't put them back, because you have no way of telling where they were. You have to make sure they remain in the string in the first place (by representing them with an escape sequence).
var db_1 = 'C:\\this\\path';
You can use:
echo json_encode('C:\this\path');
json_encode
can be used as a filter function for some JavaScript code.
Try this:
var db_1 = 'C:\\this\\path';
For more info: http://www.w3schools.com/js/js_special_characters.asp