function ajaxGet(url) {
return fetch(url)
.then(response => {
if (!response.ok) {
throw new Error("Network response was not ok");
}
return response.json();
})
.catch(error => {
console.error("Error:", error);
});
}
console.log("--------------");
ajaxGet('https://api.github.com/users/hadley/orgs')
.then(jsonResponse => {
console.log("Response:", jsonResponse);
// Process the JSON response data here
});