I'm using Javascript to call FCKeditor with the editor content queried from a database. My Javascript include file is a .php file that returns the HTML for the editor.
I'm having problems when the HTML contains apostrophes as it seems to be making my javascript invalid. Is there a way to get around this, or be able to use addslashes() function on it?
Below is my code for the .php javascript include file:
I'm having problems when the HTML contains apostrophes as it seems to be making my javascript invalid. Is there a way to get around this, or be able to use addslashes() function on it?
Below is my code for the .php javascript include file:
<?php $db=mysql_connect('localhost', 'abcd', 'efgh'); mysql_select_db('db'); $query = sprintf('SELECT contents from table WHERE field = "value"'); $result = mysql_query($query); $row = mysql_fetch_assoc($result); $content = $row['contents']; ?> function createEditor() { var form = '<?php include('FCKeditor/fckeditor.php'); $oFCKeditor = new FCKeditor('FCKeditor1'); $oFCKeditor->BasePath = '/FCKeditor/'; $oFCKeditor->Width = '100%' ; $oFCKeditor->Height = '800' ; $oFCKeditor->Value = $content; $oFCKeditor->Create(); ?>'; $("ajaxcontentarea").innerHTML = form; }
Re: Problem calling FCKeditor from javascript
Re: Problem calling FCKeditor from javascript