This is my code
Code: Select all
/* This is get row count from table*/
var rowlength = document.getElementById("sublab").rows.length;
/* I create array to get information*/
var sublabdata = [];
/* push information of input to the array*/
for(var i = 1;i <= (parseInt(rowlength) - 1);i++){
sublabdata.push([document.getElementById("sub_task" + i).value,document.getElementById("sub_lab" + i).value]);
}
/* Send the information to php by json*/
$.ajax({
url: "action.php",
method: "POST",
data: { function : 'updatesublab',
updatesublab : JSON.stringify(Object.assign({}, sublabdata)),
},
success: function (result) {
},
Could you please kindly guide me how to crate json for sending to PHP?