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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.