第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何將對象的值設(shè)置為對象數(shù)組?

如何將對象的值設(shè)置為對象數(shù)組?

守候你守候我 2023-10-20 15:14:41
我嘗試過這樣的事情<script charset="utf-8">    var request = new XMLHttpRequest();    // request.open("POST", "https://localhost:8443/control/jqxGeneralServicer?sname=JQGetListCustomerByCluster&deliveryClusterId=120120", false);    request.open("POST", "https://localhost:8443/control/jqxGeneralServicer?sname=JQGetListCustomerByCluster&deliveryClusterId=${deliveryCluster.deliveryClusterId}", false);        // ${deliveryCluster.deliveryClusterId}    request.setRequestHeader('Content-Type', 'application/json');    request.send(null);    var foo = request.responseText;    var json = JSON.parse(foo);    // console.log(json["results"][0]);    var labels = new Array();    var locations = new Array();    for(i = 0; i < json["results"].length; i++){         labels.push(json["results"][i]["fullName"]);         locacations["lng"] = json["results"][i]["longitude"];         locacations["lat"] = json["results"][i]["latitude"];    }    // console.log(labels) ;           function initMap() {            const map = new google.maps.Map(document.getElementById("map"), {                zoom: 16,                center: {lat: 20.993514917846174, lng: 105.78660475957122},            });            // const labels = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";             //const labels = [            //   "C?a hàng Quang Anh",             //   "C?a hàng Quang Em",             //   "C?a hàng H?ng Th?nh",             //   "C?a hàng C?a hàng Thành H?ng"];            var locations = [                { lat: 20.9935851166474, lng: 105.78857910579417 },                { lat: 20.986910834987295, lng: 105.78535398147808 },                { lat: 20.990339683019226, lng: 105.7922698253056 },                { lat: 20.996770381033244, lng: 105.79321396285934 }                });            });請指導(dǎo)我locations從json數(shù)據(jù)源設(shè)置 var 的值。
查看完整描述

1 回答

?
倚天杖

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超3個贊

只需推送一個對象即可:

locations.push({lng: json['results'][i]['longitude'], lat: json['results'][i]['latitude']});

請注意,您不應(yīng)該使用同步 http 請求。


查看完整回答
反對 回復(fù) 2023-10-20
  • 1 回答
  • 0 關(guān)注
  • 104 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號