views:

134

answers:

3

hai

I want to give a javascript variable within a double Quotes , Can any one help me?

+2  A: 

Have you tried using \ in front of the double quotes to escape the character?

var myVar="this is my text in \"double quotes\"";
tricat
A: 

Use json_encode():

var myString = <?=json_encode('This is a "test".');?>;
Greg
I don't see that PHP is a tag on the question
Peter Bailey
Hmmmmm... I do :)
Greg
Before anyone jumps on me - check the edit history - it was originally tagged PHP
Greg
A: 

I think you're talking about string concatenation. If so, it's like:

a = "word";
b = "there should be another " + a + " in the middle of this string.";
Chuck