Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2008
    Location
    Dallas
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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?

  • #2
    New Coder
    Join Date
    Mar 2009
    Location
    Uk, North
    Posts
    47
    Thanks
    2
    Thanked 3 Times in 3 Posts
    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.

  • #3
    Regular Coder ohgod's Avatar
    Join Date
    Jun 2008
    Location
    Ohio
    Posts
    579
    Thanks
    6
    Thanked 69 Times in 69 Posts
    it's probably sending them as url encoded strings.

  • #4
    New to the CF scene
    Join Date
    Jan 2008
    Location
    Dallas
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •