$.ajax({
type: 'POST',
url: "path/to/api",
data: "banana=yellow",
success: function (data) {
alert("Success: " + data);
},
});<p>can be written as<p>jQuery.post('path/to/api',{banana:yellow},function(data){alert("Success: "+data);});<p>much simpler and easy than<p>var r = new XMLHttpRequest();
r.open("POST", "path/to/api", true);
r.onreadystatechange = function () {
if (r.readyState != 4 || r.status != 200) return;
alert("Success: " + r.responseText);
};
r.send("banana=yellow");<p>nevermind got the joke. but i think jQuery helps write faster code sometimes