php receive get

Solutions on MaxInterview for php receive get by the best coders in the world

showing results for - "php receive get"
Paul
08 Sep 2017
1// Send data trough e.g. AJAX in JavaScript
2
3$.ajax({
4    type: "GET",
5    url: 'example.php',
6    data: { "num1": 1, "num2": 2},
7    contentType: "application/json; charset=utf-8",
8    dataType: "JSON",
9    async: false
10})
11
12// You would receive it like this:
13  
14$num1 = $_GET["num1"];
15$num2 = $_GET["num2"];
16
17$sum = $num1 + $num2;
18echo $sum;
19
20// Would output: 3