<commit_before>// code from class example is used below and configured for assignment

function doXMLHttpRequest() {
  var xhr = new XMLHttpRequest();

  xhr.onreadystatechange=function()  {
   if (xhr.readyState==4) {
     if(xhr.status == 200) {
        processResponse(xhr.responseText);
    } else {
      responseArea.innerHTML="Error code " + xhr.status;
    }
   }
  }
  xhr.open("GET", "data.json", true);
  xhr.send(null);
  }

  function processResponse(responseJSON) {
        var responseObject = JSON.parse(responseJSON);
        var displayText =
                "You have "
                + responseObject.homework.length
                + " assignments Received From Server!";
        document.getElementById("responseArea").innerHTML = displayText;
        $('#responseArea').css("color", "red").show("slow");
        //now to fill table with data
        var table = document.getElementById('assignments');
        for (var i = 0; i<responseObject.homework.length; i++) {
                var row = document.createElement("TR");
                var homework = responseObject.homework[i];

                var cell1 = row.insertCell(0);
                var cell2 = row.insertCell(1);

                // Add some text to the new cells:
                cell1.innerHTML = homework.className;
                cell2.innerHTML = homework.assignment;

                table.appendChild(row);
                }
        $('#assignments').slideUp('slow');
}

// 7 jquery methods used, 2 used with chaining


    // JQUERY SCRIPT

  $(function() {  // do once original document loaded and ready
        $('#grades').hide();
        $('#assignments').hide();
        $('#message' ).fadeIn( "slow");
        $('#jquery').click(function() {
                $.getJSON("DataTwo.json", function(responseObject, diditwork) {
                        console.log(diditwork);
                        var table = document.getElementById('grades');
                        for (var i = 0; i<responseObject.grades.length; i++) {
                                var object = responseObject.grades[i];
                                var row = document.createElement("TR");

                                var cell1 = row.insertCell(0);
                                var cell2 = row.insertCell(1);

                                // Add some text to the new cells:
                                cell1.innerHTML = object.className;
                                cell2.innerHTML = object.grade;

                                table.appendChild(row);

                                }
                                $('#grades').slideDown('slow');

                                $('#message').css("color", "red").text("DO BETTER!");
                } );  // getJSON
        } );  // click
  } ); // onReady<commit_msg>Added more jquery methods<commit_after>// code from class example is used below and configured for assignment

function doXMLHttpRequest() {
  var xhr = new XMLHttpRequest();

  xhr.onreadystatechange=function()  {
   if (xhr.readyState==4) {
     if(xhr.status == 200) {
        processResponse(xhr.responseText);
    } else {
      responseArea.innerHTML="Error code " + xhr.status;
    }
   }
  }
  xhr.open("GET", "data.json", true);
  xhr.send(null);
  }

  function processResponse(responseJSON) {
        var responseObject = JSON.parse(responseJSON);
        var displayText =
                "You have "
                + responseObject.homework.length
                + " assignments Received From Server!";
        document.getElementById("responseArea").innerHTML = displayText;
        $('#responseArea').css("color", "red").show("slow");
        //now to fill table with data
        var table = document.getElementById('assignments');
        for (var i = 0; i<responseObject.homework.length; i++) {
                var row = document.createElement("TR");
                var homework = responseObject.homework[i];

                var cell1 = row.insertCell(0);
                var cell2 = row.insertCell(1);

                // Add some text to the new cells:
                cell1.innerHTML = homework.className;
                cell2.innerHTML = homework.assignment;

                table.appendChild(row);
                }
        $('#assignments').show();
        var info = "<h2></h2>";
        $(info).appendTo(table).text("YOU HAVE A LOT OF WORK");
}

// 7 jquery methods used, 2 used with chaining


    // JQUERY SCRIPT

  $(function() {  // do once original document loaded and ready
        $('#grades').hide();
        $('#assignments').hide();
        $('#message' ).fadeIn( "slow");
        $('#jquery').click(function() {
                $.getJSON("DataTwo.json", function(responseObject, diditwork) {
                        console.log(diditwork);
                        var table = document.getElementById('grades');
                        for (var i = 0; i<responseObject.grades.length; i++) {
                                var object = responseObject.grades[i];
                                var row = document.createElement("TR");

                                var cell1 = row.insertCell(0);
                                var cell2 = row.insertCell(1);

                                // Add some text to the new cells:
                                cell1.innerHTML = object.className;
                                cell2.innerHTML = object.grade;

                                table.appendChild(row);

                                }
                                $('#grades').show();

                                $('#message').css("color", "red").text("DO BETTER!");
                                var info = "<h2></h2>";
                                $(info).appendTo(table).text("Grades are ok.");
                                $(table).append(info).show();
                } );  // getJSON
        } );  // click
  } ); // onReady
{'fraction_non_alphanumeric': 0.127361673414305, 'fraction_numerical': 0.007422402159244264, 'mean_word_length': 1.500632644453817, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1729746', 'n_tokens_mistral': 1546, 'n_tokens_neox': 1439, 'n_words': 334}