Submit form with Ajax in array format, not serialized?

I want to submit a form using Ajax but I want it to be in an array, not serialized.

var form = $(this);
data: {data:form.serialize()};

gives me this in my PHP:

firstname=John&lastname=Doe&phone=123123412345

and I have to run this code in PHP to get it into the format I want:

parse_str($_POST['data'], $data);

Just seems super unnecessary and I would like to remove that step. How can I just pass the form in an array format? Thanks

76 thoughts on “Submit form with Ajax in array format, not serialized?”

  1. First off I would like to say excellent blog!

    I had a quick question in which I’d like to ask if you do not mind.
    I was interested to find out how you center yourself and clear your thoughts before writing.
    I have had trouble clearing my thoughts in getting
    my thoughts out there. I do take pleasure in writing but it just seems like the first
    10 to 15 minutes tend to be wasted simply just trying to figure out how to begin. Any
    ideas or hints? Many thanks! http://cleckleyfloors.com/

    Reply

Leave a Comment