Greetings, I'm new to wordpress and PHP. I'm trying to retrive the the_excerpt_rss() and assign it to a javascript varaible. something similar to this.
var myDesc = '<?php the_excerpt_rss(); ?>';
the problem is that the output of the_excerpt_rss() has a carriage return in it (\n) which outputs this to the browser
var myDesc = 'my value
breks js';
which obviously breaks the JS code. How do I get around this issue? I tried wrapping it with str_replace() to get rid of the \n, but that didn't work. any help is appreciated.