When you send an AJAX request to the server, the server responds with response data. There are four main types of response that you will be working. These response data types are script, text, JSON, and XML/HTML.
responseText attributes of the
XMLHttpRequest object once the request completes. In jQuery, the response data is passed as the first parameter to the AJAX handler function you define.
The script and text are handled pretty simply by the
.getScript() methods. JSON and XML/HTML can be a bit more complex.
$.getScript("scripts/ajax/newLibray.js", function(script, ...