Thank you, dear shadow wizard. But the point is I would like to get the value to use at the other function like this function getmachineId(machineId) { var machineId = []; $.getJSON('ajax/getmachines.php', { plant: vPlant, floor: vBuilding + vFloor }, function(dataList) { $.each(dataList, function(recordno, machine) { machineId.push(machine['id']); }); }); } var machineId = []; for (i=0, i<machineId, i++) { alert(machineId[i]); } But the show me undefined value. How can I solve this problems. Thanks again Narongdetch
–
NarongdetchSep 12 '11 at 9:24

You can't, you'll have to rethink the logic involved.
–
Shadow WizardSep 12 '11 at 9:28