I am using this code to serialize the form of the current submit button. It works fine!
data: $(this.form).serialize() // it is used in $.ajax()
But when I try to add my own custom parameter like this
$(this.form).serialize() +'&address_serial=' +
$('#address').val().replace(new RegExp('\n', 'g'), '<br />')
It is more likely to break the code, and the form reloads instead of staying static and sending the ajax request.
Note that I do have the return false
at the end of the code to stop further posting of the form while submit is clicked.
How can I either add a custom parameter, or alter the current value of the textarea so that each enter key gets saved!
` like `
`. It breaks the query string. But it's better to convert the newlines to HTML line break tag at server side. – Hashem Qolami Jan 20 '14 at 17:02