I have a form like this:
<form id="abc">
<div id="xyz" >
//some elements
</div>
</form>
I have bound the submit event like this:
$(function(){
$('#abc').submit(function(event){
//I want to post the data (form fields stored in element 'xyz')
$.post(/**/);
});
});
How may I post only the elements in div ‘xyz’ ?
[Edit]
When I use $(#id).serialize(), I am getting the (url encoded) key value pair. I merely want the value. the data I am trying to extract is in a textarea. It consists of a set of emails, separated by a comma. I want to post the emails to the server. I can either post the data as a JSON array (which means I will have to parse the string clientside), or send the string to the server – which is better practise?
just serialize the div: