I'm assigning the value of JS string
variable from server side code.
Like this
var fbShareTitle = "@(ViewBag.LeadTitle as string)";
ViewBag
return string value is
A "Fantastic" Lead With 'Qoute'
Now It is giving error in console
SyntaxError: missing ; before statement
I have tried this
var fbShareTitle = ("@(ViewBag.LeadTitle)").replace(/"/g, '\\"');
But now I'm getting this error.
SyntaxError: missing ; before statement
As This string will be shared on fb, So i can't modify string, like replace all "
with '
e.t.c.