AJAX/JQUERY strange behaviour for special chars

Hello I'm developing a simple application where the user can change a content in a database by simply clicking "edit and save" without page refreshes. This is done with Jquery, AJAX POST and CKeditor (the textarea from where the content is retrieved)

If I write in CKeditor textarea "Hello this is a test!" I get

<p>Hello this is  a text</p>

and everything works fine. If I write "Hello this is a cool test, isn't it?" I get:

<p> Hello this is a cool test, isn&#39;t it?</p> 

as it should be. This is ALSO sent via POST/JQuery/AJAX (verified via FireBug) but strangely in the PHP script that receivices the string if I echo the value passed I get

<p> Hello this is a cool test, isn

How is that possible? Thank you

EDIT SOLUTION FOUND: I had to add encodeURIComponent(content) in the ajax sent data

Answers


How exactly are you putting the data together and POSTing it? You need to use encodeURIComponent, however normally JQuery should be doing that for you.


Need Your Help

perl CBC DES equivalent in java

java perl encryption passwords openssl

We're trying to figure out how to do this in Java/scala:

Visual C++ 2010: ``unresolved token" LNK2020

c++-cli token linker-error

I have a VC++ 2010 solution containing two projects: ProjectX and ProjectXTests. In the current configuration, ProjectX builds as a static library and ProjectXTests as a DLL intended to test various

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.