function submitForm(y){
$.ajax({
url: "../section/pages/tableContent.php",
type: "POST",
data: {info: y},
success: function(response) {
//do something with the response here
}
});
};
Alternatively, in React I can achieve this using axios:
axios.post("../section/pages/tableContent.php", {data: y})
.then(function (response) {
const data = response.data;
//handle the data accordingly
})
.catch(function (error) {
console.error(error);
});
This would be useful if I need to manipulate the returned data before displaying it on the front end.