File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes HTML, CSS and JavaScript and the fly likes AJAX: posting a ampersand? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "AJAX: posting a ampersand?" Watch "AJAX: posting a ampersand?" New topic
Author

AJAX: posting a ampersand?

Kevin Cornwell
Ranch Hand

Joined: Feb 01, 2005
Posts: 34
I can't seem to post a '&' in a post from via AJAX. Everything else works fine.

in my form..
oFrm.my_shout.value = 'foo & bar';

AJAX...


in my php...

returns...
foo
[ June 19, 2006: Message edited by: Kevin Cornwell ]

<a href="http://www.kevincornwell.com" target="_blank" rel="nofollow">http://www.kevincornwell.com</A>
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You need to escape/encode it.

Just look at Google for JavaScript encodeURI or JavaScript escape

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60992
    
  65

Note that this is not something that is Ajax specific -- when formatting a URL by hand you must encode parameter values.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kevin Cornwell
Ranch Hand

Joined: Feb 01, 2005
Posts: 34
Works! Thanks Eric.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: AJAX: posting a ampersand?