javaee_ajax/src/main/webapp/Resources/js/app_jQuery.js
/*
   * Retrieving data from the server -> JSON data
   */
Retrieving data from the server -> JSON data
Retrieving data from the server - > JSON data
function loadJsonData(link) {
    var spin_btn = $("#spin_btn_get");
    spin_btn.show();
    var jxhttp = $.get(
      link,
      function (jsonData) {
        $("#table_content").html("");
        for (var i = 0; i < jsonData.length; i++) {
          document.getElementById("table_content").innerHTML += `<tr>
                    <td>${jsonData[i].nom}</td>
                    <td>${jsonData[i].prenom}</td>
                    <td>${jsonData[i].fonction}</td>
                </tr>`;
        }
      },
      "json"
    );
    jxhttp.fail(function () {
      alert("Impossible de récupérer les données !");
    });
    jxhttp.always(function () {
      spin_btn.hide();
    });
  }
function loadJsonData ( link ) { var spin_btn = $ ( "#spin_btn_get" ) ; spin_btn . show ( ) ; var jxhttp = $ . get ( link , function ( jsonData ) { $ ( "#table_content" ) . html ( "" ) ; for ( var i = 0 ; i < jsonData . length ; i ++ ) { document . getElementById ( "table_content" ) . innerHTML += ` ${ jsonData [ i ] . nom } ${ jsonData [ i ] . prenom } ${ jsonData [ i ] . fonction } ` ; } } , "json" ) ; jxhttp . fail ( function ( ) { alert ( "Impossible de récupérer les données !"); } ) ; jxhttp . always ( function ( ) { spin_btn . hide ( ) ; } ) ; }
Retrieving data from the server -> JSON data
Retrieving data from the server - > JSON data