INNER CODE UNIT · JavaScript
receivedResponse
microsoft/azuredevopslabs · js/jekyll-search.js:25
function receivedResponse(xhr) {
return 200 == xhr.status && 4 == xhr.readyState
}
function handleResponse(xhr, callback) {
xhr.onreadystatechange = function() {
if (receivedResponse(xhr)) try {
callback(null, JSON.parse(xhr.responseText))
} catch (err) {
callback(err, null)
}
}
}
var self = this;
self.load = function(location, callback) {
var xhr = window.XMLHttpRequest ? new XMLHttpRequest : new ActiveXObject("Microsoft.XMLHTTP");
xhr.open("GET", location, !0), handleResponse(xhr, callback), xhr.send()
}