What are the advantages and disadvantages of using synchronous AJAX requests in PHP scripts for retrieving data from the server?

When using synchronous AJAX requests in PHP scripts to retrieve data from the server, one advantage is that it simplifies the code structure as the requests are executed sequentially. This can make it easier to manage the flow of data and ensure that the responses are handled in the correct order. However, synchronous requests can also block the browser's UI during the request, leading to a potential decrease in performance and responsiveness.

<?php
// Example of using asynchronous AJAX request in PHP script
if(isset($_GET['data'])){
    $data = $_GET['data'];
    
    // Process the data here
    
    // Return the response
    echo json_encode(['message' => 'Data processed successfully']);
}
?>