Try
1) In the main.js
`myobj = new Array();
myobj["field1"] = field1;
myobj["field2"] = $("#field2").val();
myobj["field3"] = $("#field3").val();
myobj["field4"] = field4; `
field1 and field 4 if you have the value directly and field2 and field 3 if it comes from a html form. Now put it
`FormArray(myobj);
var data = JSON.stringify($("#form").serializeObject());`
Now you need to call the php function that is going to receive the data. Ye it can be confused so it is a great method.
`$.ajax({
url: 'yourphpfile.php?,
data: {
module: 'path',
datos: data, // Your data flying to php here
},
async: false,
type: 'POST',
success: function(html){
}`
Now in yourphpfile.php that is going to receive the data put
`$datos = json_decode($datos);
$field1 = $datos->field1;
$field2 = $datos->field2
$field3 = $datos->field3
$field4 = $datos->field4`
Hope it help you!!