'Convert PHP string to javascript string [closed]
For example, I have this php string: "2015-06-26". I want to assign it to a javascript var.
I tried with String("2015-06-26"), but it's substracting the numbers, so the result is this: "1983".
How am I supposed to do it? Thanks.
Solution 1:[1]
what about that?
var date = '<?php echo str_replace("'", "\'", $yourstring);?>';
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Community |
