Hello, I am posting a contact form via ajax to a classic asp page.
If I post the following in the comments: Line1 Test Line2 Test Line3 Test Line4 Test The results emailed in the form are as follows Line1 Test Line2 Test Line3 Test Line4 I have tried updating the asp page and replacing the linebreaks with br's however it has no effect, here is the asp code I use on normal forms. CustomerMessage = Replace(Request("Message"),VbCrLf, "<br />") As the replace in the asp had no effect I assumed that forms submitted via ajax are perhaps slightly different? I have added a replace to the form handler: var Message = $('#Message').val().replace('\n', '<br />'); This kind of works but it will only recognise the first new line so I get: Line1 Test Line2 Test Line3 Test Line4 The aim is to submit the form and for the form handler to keep the paragraphs from the text area. Here is the complete code below: <script type="text/javascript"> jQuery(function() { var containerContact = $('div.containerContact'); var v = jQuery("#Contact").validate({ errorContainer: containerContact, errorLabelContainer: $("ol", containerContact), wrapper: 'li', meta: "validate", submitHandler: function(form) { $.ajaxSetup({dataType: "text"}) $('#formmessage').hide(); var Message = $('#Message').val().replace('\n', '<br />'); $.post('/scripts/contact.asp',{Name:$('#Name').val(),Email:$ ('#Email').val(),Telephone:$('#Telephone').val(),Message: Message,rand:Math.random() }, function(datanew) {$('#Contact').hide();$ ('#contact_success').empty();$('#contact_success').append(datanew);$ ('#contact_success').fadeIn(); }); return false; } }); }); </script> Any ideas would be most welcome! Thanks James