I'm new to ajax, so I maybe making a simple mistake. But whenever I send a string from a form that contains a #, that and everything after it never makes it into the database.
Can anyone tell me how to get around this?
__________________
$guiness &= new sixpack();
$guiness->chug();
This helped me a lot- I was having a problem with linebreaks.
I've noticed that even with escape() the + symbol gets lost (everything else stays the same, but + symbols become spaces). Are there any other symbols that won't work even with escape(), and how can we keep those as well?
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
Use encodeURIComponent instead. Actually, there are 3 different methods of encoding the URL: escape, encodeURI and encodeURIComponent. See the difference here.
In the description of encodeURIComponent() the article states
Quote:
the encodeURIComponent method encodes all characters
however near the bottom it states
Quote:
encodeURIComponent() will not encode: ~!*()'
What's up with that?
It means that it encodes all characters that are special in any way in a URI. However, the characters "~", "!", "*", "(", ")" and "'" have no special meaning in URI and don't need to be encoded.