God day, i copied this expample from thislink in stackoverflow and it works fine, how do i now turn it into a variable that i can use throughout the rest of my project as i have put in the exapmle below, it wont give me the values i get inside the function, it writes undefined.
function something(callback){
$.ajax({
type: "GET",
contentType: "application/x-www-form-urlencoded",
url: "http:url.com",
dataType: 'json',
success:
callback
// console.log(data);
// console.log(JSON.parse(data));
// window.location.replace("mainkedaabuild.html"+"?#"+data );
,
error: function()
{
$('#output').html("Unable to connect");
// window.location.replace("404kedaa.html");
}
});
};
var Blue = something(function (data) {
data; return data;
})
console.log(Blue);