Ciao a tutti, ho usato ajax form dove invio i dati di un un form ad una pagina che salva i dati nel db.

La pagina che salva i dati nel db è in asp e salva i dati correttamente, ma ricevo la stringa senza il salto riga ma con uno spazio.

il codice che invia i dati alla mia pagina asp è il seguente:

codice:
$(document).ready(function() {
	
	//if submit button is clicked
	$('#submit').click(function () {		
	
		
		//Get the data from all the fields;
		var comment = $('textarea[name=comment]');

		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
		
   var rads = document.getElementsByName("r1");
   
   for (i=0; i < rads.length; i++)
	{
      if (rads[i].checked)
	  {
          chiusura= rads[i].value;
	  }
}
		
				
		if (comment.val()=='') {
			comment.addClass('hightlight');
			return false;
		} else comment.removeClass('hightlight');
		
		
		
		
		//organize the data properly
		var data = 'comment='  + encodeURIComponent(comment.val());
		
		
                //data.replace(/%0D%0A/gi,"
"); 		
                //data.replace(/([^>\%0D\%0A]?)(\%0D\%0A|%0A\%0D|\%0D|%0A)/g,'$1$2'); 			
                alert(data);	 
			
		//disabled all the text fields
		$('.text').attr('disabled','true');
		
		//show the loading sign
		$('.loading').show();
		
		//start the ajax
		$.ajax({
			//this is the php file that processes the data and send mail
			url: "ordina.aspx",	
			
			//GET method is used
			type: "POST",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
			//success
			success: function (html) {				
				//if process.php returned 1/true (send mail success)
				
				if (html==1) {					
					//hide the form
					$('.form').fadeOut('slow');					
					
					//show the success message
					$('.done').fadeIn('slow');
					
					$('#mex').fadeIn('slow'); 
					
					//document.getElementById('mex2').innerHTML = comment.val();
					
				//if process.php returned 0/false (send mail failed)
				} 
				else
				{ alert('Si è verificato un errore. Ti invitiamo a riprovare più tardi!');					
					alert(html);
				}
			}		
		});
		
		//cancel the submit button default behaviours
		return false;
	});	
});

In rosso è il codice che ho aggiunto per capire in che modo passa il dato javascript e alla seguente stringa
************
abc 123
def

456
**********

quello che mi restituisce l'allert è
******
comment=abc%20123%0Adef%0A%0A456
******

il problema è che non riesco a far convertire il %0A in
, ho provato entrambe le stringhe ma senza risultato!

Qualcuno puo darmi una mano?

Grazie

Ciao

Androita