📅  最后修改于: 2022-03-11 14:53:51.175000             🧑  作者: Mango
// 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