0

How to jQuery ajax with input field name=“array[]”?

<form id=”myform”>
<input type=”text” name=”a[]” value=”1″ /><br />
<input type=”text” name=”a[]” value=”2″ /><br />
<input type=”text” name=”b” value=”3″ /><br />
<input id=”mysubmit” type=”submit” value=”Submit By Form” /><br />
<input id=”mysubmit2″ type=”submit” value=”Submit By Input Name” /><br />
</form>

 

$(‘#mysubmit’).live(‘click’, function() {
alert($(‘#myform’).serialize());
return false;
});
$(‘#mysubmit2’).live(‘click’, function() {
alert($(‘#myform input[name=”a[]”]’).serialize());
return false;
});

Demo:http://jsfiddle.net/VbqSS/68/

Sandeep Kumar

Sandeep kumar is a web developer and a professinal blogger. He works for latest technologies and write articles what he learn. In ICodeHub he share web languages tutorials and other programming tips and tricks. if you need some help or have some suggestion then mail him at sandeep92pal@gmail.com without any hesitation. He believes in learning and sharing.