try 
c = encodeURIComponent("my content with a & lalal test");



var pars = 'id='+ident+'&content='+encodeURIComponent(new_content);


zelexir wrote:
> 
> Hi there.
> 
> I ran into a little problem today, working with some forms. Whenever
> something is submitted and has a "&" in it it will break my code. For
> instance:
> 
> I have a admin interface with a WYSIWYG editor, so whenever a &nbps; or
> " or anything similar it will break in this part:
> 
> var pars = 'id='+ident+'&content='+new_content;
> 
> lets say the editor only contains <p>&nbsp;</p>
> what my PHP serverside will give my is 
> * $_POST['id']="theID";
> * $_POST['content']="<p>";
> * $_POST['nbps;</p>']=""
> 
> testing this more I tried to input this:
>  * firstContent&content2=moreContent&content3=evenMore!
> which then gave me the following array
> Array ( [id] => content-48-news [content] => firstContent [content2] =>
> moreContent [content3] => evenMore! )
> 
> I had a hard time trying to search for info on this, but I hope anyone
> here could give me some assistance, what can I do to be able to allow "&"
> in the input? Tried the .serialize() with the same outcome, is replacing
> the '&' with Clientside javascript before posting with something else, and
> then revert it serverside really the only option I got?
> 
> Thanks in advance!
> 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-%22-%22-when-posting-with-ajax.-tf3081836.html#a8563453
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to