I am new to using Ajax and am getting the success message here but there is an error that the variable is not defined.
//Variable TotalPoints is already set
$.ajax({
type: "POST",
url: 'save_pts.php',
data: {'TotalPoints' : Allpts},
success: function(data)
{
alert ('Success'):
}
});
<?php // save_pts.php
$Allpts = $_POST['TotalPoints'];
?>
<script>
alert("<?php echo $Allpts ?>");
</script>