通過Ajax我得到一個JSON對象循環,我想看看,雖然所有這些項目。這裏是我的ajax如何通過JSON對象
document.getElementById('ACOptions').innerHTML = "";
$.ajax({url: "SearchAvailableAircraft.php?ID=<?php echo $SimID; ?>&Code=<?php echo $SimCode; ?>&Search=" + S, success: function(result){
/*alert(result);*/
var MyAircraftList = result.AircraftList;
而下面是我的回答
{"status":200,"status_message":"Valid Account","AircraftList":[{"ID":"1","FullTXT":"Boeing 777-200ER","TypeCode":"772","Manufacturer":"Boeing","Model":"777","Variant":"200ER","PaxCnt":"305","RangeNM":"5240","MinRwFT":"8000","Cost":"261500000","DeliveryDelay":"18"},{"ID":"2","FullTXT":"Airbus A320-200","TypeCode":"320","Manufacturer":"Airbus","Model":"A320","Variant":"200","PaxCnt":"186","RangeNM":"3300","MinRwFT":"2100","Cost":"98000000","DeliveryDelay":"9"}]}
我怎樣才能循環儘管這些知道我的目標是result.AircraftList
不是因爲我有一個數組數組。 – Jason
好,所以內部循環將從該答案。外循環將從這個答案:[在JavaScript中通過數組循環](http://stackoverflow.com/questions/3010840/loop-through-an-array-in-javascript) – styfle
循環和做什麼? –