Hello i use this piece of code to convert json file to an object. My problem is that i can't use the variable respons in any other function. Anybody knows how to solve this problem?
var response;
function AJAX_JSON_Req( url )
{
var AJAX_req = new XMLHttpRequest();
AJAX_req.open( "GET", url, true );
AJAX_req.setRequestHeader("Content-type", "application/json");
AJAX_req.onreadystatechange = function()
{
if( AJAX_req.readyState == 4 && AJAX_req.status == 200 )
{
response = JSON.parse( AJAX_req.responseText );
}
}
AJAX_req.send();
}