Okay my problem is the following:
I am trying to access a variable I defined with javascript in my executing php-script.
// CLIENT SIDE CODE
function deleteEntry() {
var action = '_includes/deleteEntry.php';
var method = 'post';
var data = '2';
$.ajax({
url: action,
type: method,
data: data
}).done(function(data){
$('.main').empty();
$('.main').append(data);
});
};
Now I want to make use of my data in a php-script (deleteEntry.php)
// SERVER SIDE CODE
<?php
// VERBINDUNG //
$connection = mysqli_connect('localhost', 'root', '', 'aufgabenplaner');
// if (!$connection){
// die('Verbindung nicht möglich : ' . mysql_error());
// }
// SQL-ABFRAGE //
$query = "DELETE FROM aufgaben WHERE job_nr =" ."DATA GOES HERE!!!";
$result = mysqli_query( $connection, $query );
include 'main-content.php';
?>
Where it says "DATA GOES HERE!!!" I want to make use of the data value, but I don't know how.