Hi!
I need your help, I am stuck with a - for sure - small problem, but I can't find it...
I am going to save content from the FCKeditor by posting it within an AJAX request.
The request itself seems to work, but when I try to save the content, it is cutted at the first Entity.
Some Code snippets:
JS:
parameters = 'content='+encodeURI(getFCKInstance().GetXHTML(true));
myXmlHttp.open( "POST", urlToCall, bAsync );
myXmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
myXmlHttp.setRequestHeader("Content-length", parameters.length);
myXmlHttp.setRequestHeader("Connection", "close");
myXmlHttp.send(parameters);
PHP:
$parsedContent = stripslashes($_POST['content']);
When I log the content server side, it gives me everything until the first entity.
For example I post:
Hello World, this is a double "entity" sentence.
As HTML it will be:
Hello World, this is a double "entity" sentence.
At Server side I get:
Hello World, this is a double
I think the " is interpreted as new parameter, cause of the & as Parameter splitter and therefor not available in the Request Parameter "content".
Hope you understand my problem
Kevin
Fri, 12/29/2006 - 08:42
#1
RE: Saving via AJAX and PHP
the problem is with the encodeURI line.
encodeURI() does not encode the '&' character, so your POST data is artificially split into separate parts [0].
Instead, try using encodeURIComponent.
Kae
0: http://developer.mozilla.org/en/docs/Co ... :encodeURI
RE: Saving via AJAX and PHP
I have just built a plugin to post the editor's content to the server. I have called it the ajaxPost plugin.
personal page and demo for the plugin: http://www.saulmade.nl/FCKeditor/FCKPlugins.php
plugin and download page at sourceforge: http://sourceforge.net/tracker/index.ph ... tid=737639
forumThread: http://sourceforge.net/forum/forum.php? ... _id=257179