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

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -