httpRequest.onreadystatechange = function() { if (httpRequest.readyState === 4 && httpRequest.status === 200) getProduct(httpRequest.responseText); };