Jump to content

[SOLVED] nl2br qjuery ajax and GET


gevans

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/148239-solved-nl2br-qjuery-ajax-and-get/
Share on other sites

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);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.