This is my ajax script:
var cid = $(this).data('cid');
var sendData = { canidtoset: cid };
$.ajax({
url: '/functions/cv_showinformation.php',
type: 'post',
data: sendData,
dataType: 'json',
success: function(data) {
$('#can-viewer .cv--informationtab .infotab--inner')
.load("/functions/cv_showinformation.php");
}
});
It gets the value of an attribute called data-cid from an clicked element. This value should be send to an PHP-Script that gets included into a div after the element was clicked. The PHP-Script:
<?php
if(isset($_POST['canidtoset'])){
$canid = $_POST['canidtoset'];
echo $canid;
} else {
echo "Something went wrong";
}
?>
In the end it should show the value from the attribute in the div. But it doesn't even gets included so I believe the data wasn't set. Where the hella is the mistake?