I am accessing json data from other domain using JSONP with callback function.
I am able to access data and in success function i am pushing json data to a array (items[ ]) but i am not able to access that array outside ajax call function.
How can i access the Items[ ] array outside ajax call. below is the code.
Thanks in advance
$.ajaxSetup({ "async": false });
var items = [];
$.ajax({
type: "GET",
url: "http://aaa.com/.wrf=callback",
//data: "{}",
crossDomain: true,
jsonpCallback: 'callback',
contentType: "application/json; charset=utf-8",
dataType: "jsonp",
success: function (msg) {
$.each(msg.response.docs, function (key, value) {
items.push([this["ID"]]);
return items;
});
},
async: false,
error: function (msg) {
alert(msg);
}
});