i try to pass php value which is $row['desc'], to javascript. and this error appear, 'unterminated string constant', if the data dont have space like 'test', then no error appear, if the data like 'test test', then the error will appear. any solution for this, the code is like this

About different between <?php ?> and <? ?> - You can use both variants but second will work only on those servers where the short_open_tag flag set to 1. Not all of them allow this so best practice is to use <?php ?>. http://www.php.net/manual/en/ini.core.php