How to encode content to send them via jquery to a php file?
- by phpheini
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