Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-31-2007, 11:54 PM   PM User | #1
The Reverend
New Coder

 
Join Date: Mar 2006
Location: I'm lost, livin inside myself
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
The Reverend is an unknown quantity at this point
Problem sending '#' via ajax

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();
The Reverend is offline   Reply With Quote
Old 06-01-2007, 03:46 AM   PM User | #2
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
You should escape() the querystring you pass to the URL.
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 06-03-2007, 06:54 PM   PM User | #3
djmonkey1
New Coder

 
Join Date: Mar 2006
Location: In an apartment.
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
djmonkey1 is an unknown quantity at this point
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?
djmonkey1 is offline   Reply With Quote
Old 06-04-2007, 05:57 AM   PM User | #4
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
Use encodeURIComponent instead. Actually, there are 3 different methods of encoding the URL: escape, encodeURI and encodeURIComponent. See the difference here.
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 06-04-2007, 01:51 PM   PM User | #5
djmonkey1
New Coder

 
Join Date: Mar 2006
Location: In an apartment.
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
djmonkey1 is an unknown quantity at this point
Thanks for that tip.

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?
djmonkey1 is offline   Reply With Quote
Old 06-04-2007, 02:49 PM   PM User | #6
liorean
The thread killer


 
Join Date: Feb 2003
Location: Umeå, Sweden
Posts: 5,575
Thanks: 0
Thanked 84 Times in 75 Posts
liorean will become famous soon enoughliorean will become famous soon enough
Quote:
Originally Posted by djmonkey1 View Post
Thanks for that tip.

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.
__________________
liorean <[lio@wg]>
Articles: RegEx evolt wsabstract , Named Arguments
Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards
liorean is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:24 AM.


Advertisement
Log in to turn off these ads.