tags:

views:

114

answers:

3

Hi,

I am having trouble trying to get all my form data and break it down for debugging. I just want to replace the "&" with a new line.

var formData = $("#customer_details_form").serialize();  
var debugData = formData.text().replace(/&/g,'\n');

Thanks

+1  A: 

formData is an ordinary string.
Remove the .text() call.

SLaks
+3  A: 

jQuery's .serialize() method returns a String, not a jQuery object, so get rid of .text().

var formData = $("#customer_details_form").serialize();  
var debugData = formData.replace(/&/g,'\n');
patrick dw
A: 

The variable formData has the string, so text() shouldn't be necessary.
Try formData.replace(/&/g,'\n');.

Alec
Thanks for the reply I tried that and didnt work so I looked a little harder. I had vars debugData and debug_data. lol thanks again!
moo