I just made up some code with the help of some nice Stackers. However, it does not seem to send the data at all. I should receive 'theid' at the page, where a query should run, however the query doesn't even get executed because I think there is no data submitted to the page, or am I getting the data incorrectly?
$(document).ready(function() {
$(".myButton").on("click", function() {
var id = $(this).data("id");
$.ajax({
type: "POST",
url: "index.php?url=seenot",
async: true,
data: {"theid": id },
success: console.log("Een Notificatie is als gelezen gemarkeerd | ID: " + id)
});
});
});
The file seenot
$id = $_POST['theid'];
$setseen = mysql_query("UPDATE cms_notifications SET userstatus = 'seen' WHERE id = '".$id."'")or die(mysql_error());
I'm aware that MySQL is deprecated. I'm sorry. Thanks in advance.