php receive get code example
Example: php receive get
// Send data trough e.g. AJAX in JavaScript
$.ajax({
type: "GET",
url: 'example.php',
data: { "num1": 1, "num2": 2},
contentType: "application/json; charset=utf-8",
dataType: "JSON",
async: false
})
// You would receive it like this:
$num1 = $_GET["num1"];
$num2 = $_GET["num2"];
$sum = $num1 + $num2;
echo $sum;
// Would output: 3