Convert PHP string to javascript string -
for example, have php string: "2015-06-26". want assign javascript var.
i tried string("2015-06-26"), it's substracting numbers, result this: "1983".
how supposed it? thanks.
use json_encode()
convert php value corresponding javascript literal:
var datestring = <?php echo json_encode($datestring); ?>;
Comments
Post a Comment