I am having problems with this code it doesn't want to get the $_POST here is the code.
first i have a isset to check for the post
if(isset($_POST['deleteRecord'])){
echo $_POST['deleteRecord'];
};
Then i have the HTML button
<button type="button" id="deleteRecordButton" class="btn btn-primary btn-block">Delete Record</button>
And this is the jquery call to post
$('#deleteRecordButton').click(function(){
$(':checkbox').each(function(){
if($(this).is(':checked')&& $(this).attr('id') != "check_all"){
$.post('home.php',{deleteRecord: 1});
$(this).prop('checked',false);
}
});
});
all this is in 1 php file called home.php. For some reason i can't get the $_POST any idea?
Your $.post is not getting anything back, as @adeneo said
Do something like this to see what you get back from the server:
$("#your_button_id").click(function () {
var data = DATA_YOU_WANT_TO_SEND
$.post("home.php", data)
.done(function (data_from_server) {
alert(data_from_server)
//Then you will see what your AJAX Call gets from the server
})
.fail(function (jqXHR, textStatus, errorThrown) {
console.log(jqXHR)
});
});