I'm sending data via ajax (jquery) to php where it will be processed. I'd like to return a value from the php script, but I'm not sure how.
How do I return the result back?
$(document).ready(function() { //This script sends var Score to php
Score=100; //Dummy variable
$.ajax({
type: "POST",
url: "returnresults.php",
data: { 'Score':Score },
success: function(){
$('#box2').html(Score);
}
})
});
Very simple PHP CODE
<?php
$Score=$_POST['Score'];
if (isset($_POST['Score'])) {
$Score=80;
}
?>