WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 0 down vote accepted

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

share|improve this answer
Thanks for the help!!! I will use parse-str to parse the values. Thanks – Pritesh Jul 13 '14 at 14:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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