I am writing a plugin with dynamic no. of input fields in form. To submit form via ajax, I have used jquery serialize() function.
$(".submit").submit(function( event ) {
event.preventDefault();
var data = {
action: 'wpaie_ajax_action',
operation: 'import',
importData: $(this).serialize()
//do some operation
};
$.post(ajaxurl, data, function(response) {
});
});
Ajax is working fine and data is also serialized but I am not able understand how to read the form input fields.
If I am using echo $_POST["importData"]
, it is showing me serialized data but what should
be the correct way to read that serialized data.