Nicholas Gorman
Nicholas Gorman

Reputation: 1

convert form data using serializeArray() and sending php via .Ajax

This is my first post. I have searched for other solutions and what I've found only deals with components of this question. Basically this is what I'd like to do:

Bellow is the code I'm using. But first, here are some alternatives I've tried. Usually I get this: array(0) { }

and here is the datacapture.php script I'm using to test the information flow.

<?php 

var_dump($_POST);

?>

EDIT - and here is a sample form item, reading .text and .name from my settings.json file:

<tbody>
                {
                this.props.settings.schemes[0].questions.map((q, i)=> {
                    return <tr><td>{q.text}</td><td><div class="YesNo"><input type="radio" required name={q.name} value="yes">Yes</input><input type="radio" required name={q.name} value="no">No</input></div></td></tr>
                })
                }
            </tbody>

Upvotes: 0

Views: 1651

Answers (1)

Jitesh
Jitesh

Reputation: 1

just change 1seralisedForm1 to 1seralisedData1 it will return an json object to php which can be seen by doing:

echo json_decode($_POST);

Upvotes: 0

Related Questions