I'm kind of new to using ajax but I've been largely successful. Most of my ajax calls look very similar to this:
function saveQueryProf(){    
    var currentDate = new Date();
    var date=currentDate.getDate()+'/'+(currentDate.getMonth()+1)+'/'+currentDate.getFullYear();
            $.ajax({
            type: "POST",
            url: "API.php",
            data: { method: "createQueryProfile",
                    prof_name: $('#nameTxt').val(), 
                    prof_SQL: $('#sqlTxt').val(),
                    date: date
                  },
            datatype: "json"
        }).done(function(returnresult) {
        })
}
Using the $.ajax({ method. However, any time I see someone using "ajax" on youtube or other sites, their code looks more like this:
function loadDoc() {
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
     document.getElementById("demo").innerHTML = this.responseText;
    }
  };
  xhttp.open("GET", "ajax_info.txt", true);
  xhttp.send();
}
I realize that these are doing different things, but what is the difference in these 2? And when I'm looking for answers online how could I find an answer that is more along the lines of the first style?
 
     
     
     
    