How can I perform AJAX requests with jQuery

AJAX, jQuery, Asynchronous JavaScript and XML, API requests
This example demonstrates how to perform AJAX requests using jQuery for seamless web applications.

        $(document).ready(function() {
            $("#myButton").click(function() {
                $.ajax({
                    url: "https://api.example.com/data",
                    type: "GET",
                    dataType: "json",
                    success: function(data) {
                        console.log(data);
                        $("#result").html("Data: " + data.someValue);
                    },
                    error: function(xhr, status, error) {
                        console.error("Error: " + error);
                    }
                });
            });
        });
    

AJAX jQuery Asynchronous JavaScript and XML API requests