I am trying to post data to a php file through ajax call. But I could not get those data in my php file. It just returns the empty array when I check using var_dump($_POST). Anyone help me on this.
Here is my ajax script
<script>
$.ajax({
url: "update_user.php",
type: 'post',
data: {
"type": "active"
},
error: function (e) {
},
success: function(data) {
}
});
</script>
In update_user.php,
<?php
var_dump($_POST);
?>
It returns array(0) { }
I think type should be POST (uppercase not lower).
$.ajax({
url: "update_user.php",
type: "POST",
data: {
type: "active"
},
error: function (e) {
},
success: function(data) {
}
});