I have global variable fan_coil_ai_bi, and I use that variable to store some data which I get from request, but problem is that len_1 is 1 ( what is ok value in this case ) and len_2 is undefined (what is wrong). How that happen in my function bellow ? How to achieve that len_2 have same value like len_1 ? What is wrong with this code ?
function read_required_fields(fan_coil_id) {
var parameters = {};
parameters['command'] = 'read_required_fields';
parameters['fan_coil_id'] = fan_coil_id;
$.get("php_scripts/network_script.php", parameters, function(data) {
fan_coil_ai_bi=data;
alert('len_1='+fan_coil_ai_bi.length);
}, "json");
alert('len_2='+fan_coil_ai_bi.length);
}