I have this ajax request call to a json supported link (url1):
$.ajax({
type : "GET",
dataType : "json",
url : url1,
success: function (data) {
c1lat1 = [(data[0].boundingbox[0]),(data[0].boundingbox[2])];
alert(c1lat1);
}
});
This works perfectly fine, and the alert does give the number I want. However, if I try this:
$.ajax({
type : "GET",
dataType : "json",
url : url1,
success: function (data) {
c1lat1 = [(data[0].boundingbox[0]),(data[0].boundingbox[2])];
}
});
alert(c1lat1);
It gives me an empty alert box, and therefore it looks like it's not saving the value into the variable into the request.
How can I get around this as I need that value retrieved?
Thanks!