I have the following code in js:
$("#myForm").submit(function(event) {
event.preventDefault();
$.when(getDatas(this.id)).done(function(r_getDatas){
$('#loader').toggleClass("show hide");
});
function getDatas(id) {
return $.post("update.php", {
updateType: id,
data: $('#'+id).serialize()
}, "json");
}
});
How to access the serialized values in PHP ?
I tried print_r($_POST)
without success.
Thanks.
use serializeArray()
:
function getDatas(id) {
return $.post("update.php", {
updateType: id,
data: $('#'+id).serializeArray()
}, "json");
}
Try it once more