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 09-08-2009, 03:32 AM   PM User | #1
kuba1
New to the CF scene

 
Join Date: Jan 2008
Location: Dallas
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
kuba1 is an unknown quantity at this point
AJAX string functions characters that won't work

I am working on a script that does a simple check on strings that users input as usernames.

Everything works, exactly as expected with the exception of one item.

I am assuming that the problem I see with this script is associated with some sort of Java script limitation, so I have decided to ask the professionals.

I am using an onkeyup to pass characters to a php script that checks the input string to be the correct length, using characters that are allowed for use and presenting the user with a red light or green light to continue.

All characters seem to work fine with the exception of three "&, #, and +". The Java onkeyup does not seem to pass these three characters to the php. Why? and ..... is there a workaround?
kuba1 is offline   Reply With Quote
Old 09-08-2009, 09:02 PM   PM User | #2
Kelon
New Coder

 
Join Date: Mar 2009
Location: Uk, North
Posts: 47
Thanks: 2
Thanked 3 Times in 3 Posts
Kelon is an unknown quantity at this point
The characters are awkward because they're operators etc.,
Do you want them passing to the php because that will have issues too? They'll need escaping. Usually it's best to scan for them and disallow them.
Kelon is offline   Reply With Quote
Old 09-09-2009, 02:42 PM   PM User | #3
ohgod
Regular Coder

 
ohgod's Avatar
 
Join Date: Jun 2008
Location: Ohio
Posts: 579
Thanks: 6
Thanked 69 Times in 69 Posts
ohgod is on a distinguished road
it's probably sending them as url encoded strings.
ohgod is offline   Reply With Quote
Old 09-12-2009, 11:28 PM   PM User | #4
kuba1
New to the CF scene

 
Join Date: Jan 2008
Location: Dallas
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
kuba1 is an unknown quantity at this point
This is figured out. Thanks for the replies. We needed to use post instead of get in the ajax because the php was blocking the use of the three characters in url's when they are unencoded.

And kelon was correct, we used encodeURI in the javascript to overcome further issues.
kuba1 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 05:48 PM.


Advertisement
Log in to turn off these ads.