bluebutterflyofyourmind Posted July 17, 2008 Share Posted July 17, 2008 Hey there so i'm trying to pass a body of text through ajax to my php script. the issue is that if they put in an & or sometimes quotes, the text gets messed up. the quotes are just an html thing i guess. but the & cause the AJAX line passing the variable to the php to think that everything after is now a new variable. is there a way to pass text, and have it isolated so that it doesn't affect the javascript? thanks! Link to comment https://forums.phpfreaks.com/topic/115239-solved-passing-amps-and-quot-s-through-ajax/ Share on other sites More sharing options...
corbin Posted July 18, 2008 Share Posted July 18, 2008 Either use encodeURI or Google "javascript version of urlencode." Link to comment https://forums.phpfreaks.com/topic/115239-solved-passing-amps-and-quot-s-through-ajax/#findComment-593022 Share on other sites More sharing options...
bluebutterflyofyourmind Posted July 18, 2008 Author Share Posted July 18, 2008 Haven't had chance to try it yet but that looks like exactly what i'm looking for. after passing that to my php script though, how do i work with what's passed? Do i need to decode? and if so how? thanks a ton! Link to comment https://forums.phpfreaks.com/topic/115239-solved-passing-amps-and-quot-s-through-ajax/#findComment-593440 Share on other sites More sharing options...
corbin Posted July 18, 2008 Share Posted July 18, 2008 PHP should automatically handle the decoding. Link to comment https://forums.phpfreaks.com/topic/115239-solved-passing-amps-and-quot-s-through-ajax/#findComment-593717 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.