Using $.post to send JS variables to PHP script
.post, javascript, php
Solution
type $_POST instead of $POST. also, on a windows based machine, you can use ctrl + shift + j to debug a js script - which will help if if there's any problems with your code. but, the js code you have shown us looks perfectly fine.
Problem
I am trying to send Javascript variables over to a PHP script for updating scores of a quiz game. I've looked up the shorthand method of doing this, which is $.post, but I am unable to retrieve the values in the PHP script. I am fairly unfamiliar which JS and require help as to what I am doing wrong. Here is the Javascript ``` function updatescore(){ var thisgamemarks= 2300; var thequizid = 5; $.post("updatemark.php", { quizidvalue: thequizid, newmarkvalue: thisgamemarks } ); } ``` And the PHP ``` $studentnewmark = $POST['newmarkvalue']; $thisquizid = $POST['quizidvalue']; $thisstudentid = $_SESSION['studentid']; ```