Pass Data from Ajax to PHP with GET Request

Create new php file named ajax.php as below:

<?php 
    $id = $_GET['id'];
    $username = $_GET['username'];
    $price = $_GET['price'];
    echo 'id: '.$id;
    echo '<br>username: '.$username;
    echo '<br>price: '.$price; 
?> 

Create new php file named index.php as below:

<html>

    <head>
        <title>nilpointer.net</title>
        <script src="js/jquery-3.6.0.min.js"></script>
        <script>
            $(document).ready(function() {

                $('#buttonDemo').click(function() {
                    $.ajax({
                        type: 'GET',
                        data: {
                            id: 123,
                            username: 'abc',
                            price: 4.5
                        },
                        url: 'ajax.php',
                        success: function(data) {
                            $('#result').html(data);
                        }
                    });
                });

            });
        </script>
    </head>

    <body>

        <input type="button" value="Demo Ajax" id="buttonDemo">
        <br>
        <span id="result"></span>

    </body>

</html>