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 ) {
        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.

1 Answer 1


Provided that your server receives data in the form of a string which it should if you're using the jQuery serialize() function.

It will be something like:


You just need to parse the string into an array as follows:

$parameters = array(); parse_str($_GET, $parameters);

See the following for more information: http://www.php.net/manual/en/function.parse-str.php

  • Thanks for the help!!! I will use parse-str to parse the values. Thanks
    – Pritesh
    Commented Jul 13, 2014 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.