How to encode content to send them via jquery to a php file?
Posted
by
phpheini
on Stack Overflow
See other posts from Stack Overflow
or by phpheini
Published on 2011-11-18T01:47:35Z
Indexed on
2011/11/18
1:50 UTC
Read the original article
Hit count: 121
I am trying to send a form to a php file via jquery. The problem is, that the content, which has to be sent to the php file, contains slashes (/) since there is bb code inside. So I tried the following:
$.ajax(
{
type: "POST",
url: "create.php",
data: "content=" + encodeURIComponent(content),
cache: false,
success: function(message)
{
$("#somediv").html(message);
}
});
In the php file I use rawurldecode to decode the content and get my bb codes back which I can then transform into html. The problem is as soon as I put the encodeURIComponent() it will ouput: [object HTMLTextAreaElement]
What does that mean, where is my mistake?
Thanks for your help! phpheini
© Stack Overflow or respective owner