gevans Posted March 6, 2009 Share Posted March 6, 2009 Hey guys, bit of a mix of code. Gonna try and explain this and see if anyone knows the answer without me putting out any code, so here goes... I have a form that submits a textarea. When javascript is disabled is submits normaly.The receving page cleans the textarea as well as using nl2br() and it works. When javascript is enabled the form gets submitted via the jquery ajax event. It runs the same script on the same page but nl2br doesn't work, the resulting text has no <br />'a or \n's or \r\n's. Has any one come across this, and do you have any ideas? If you want some code just let me know. Quote Link to comment https://forums.phpfreaks.com/topic/148239-solved-nl2br-qjuery-ajax-and-get/ Share on other sites More sharing options...
Boo-urns Posted March 6, 2009 Share Posted March 6, 2009 That is interesting. Have you checked what firebug is sending? This is what I use when i am displaying a "confirm form data" page. So maybe this will help. I use the php.js located here -> http://kevin.vanzonneveld.net/techblog/article/javascript_equivalent_for_phps_stripslashes/ var desc = $('#desc').val(); desc = str_replace('\n', '<br />', desc); Quote Link to comment https://forums.phpfreaks.com/topic/148239-solved-nl2br-qjuery-ajax-and-get/#findComment-778218 Share on other sites More sharing options...
gevans Posted March 6, 2009 Author Share Posted March 6, 2009 Cheers for your help, I was following through a jquery tutorial and there was a syntax error in their code, very helpful lol Quote Link to comment https://forums.phpfreaks.com/topic/148239-solved-nl2br-qjuery-ajax-and-get/#findComment-778223 Share on other sites More sharing options...
Boo-urns Posted March 6, 2009 Share Posted March 6, 2009 d'oh stupid syntax error lol. Quote Link to comment https://forums.phpfreaks.com/topic/148239-solved-nl2br-qjuery-ajax-and-get/#findComment-778233 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.