I also tried the script type..
thanks, it worked, honestly I tried this earlier, but that didnt work the only difference was that I was trying in double questions with \" but its working in single quotes. thanks
Save yourself some future headaches when writing JS inside PHP, look at using the PHP heredoc syntax when possible.
set as resolved