Passing data between PHP and JavaScript? -
the overall idea drawing graph of somebody's scores in div. i've got button when clicked runs graph drawing function. have function retrieves data database using switch statement function shared other buttons. my data retrieval function: var getdata = function(button_id) { $.ajax({ type: "post", url: "../scripts/getdata.php", datatype: "html", data: {id: button_id}, success: function(result){ $("#profilebox").html(result); } }); }; runs getdata.php , returns values blank div. getdata.php: <?php session_start(); $switchcase = $_post['id']; $email = $_session['user']['email']; //connect database here $result=mysqli_query($con,"select * users email = '$email'"); switch ($switchcase) { case "profile_home": while($row = mysqli_fetch_array($result)) { echo $row['username'] . "...