I have the following code but it doesn't seem to work properly. I cant understand why.
JS
var updateBoard = function() {
$.ajax({
type: "POST",
url: "engine/main.php",
data: {codes: 2},
success: function(response) {
console.log(response);
}
});
setTimeout(updateBoard, 1000);
};
PHP
if(isset($_POST['codes'])) {
echo "test";
}