傢伙我有在json
format.It一直encoded
數組看起來象下面這樣: -如何從jquery/javascript中統計一個數組的鍵名?
{"result":[{"pid":"24","uf":"hancy061","ot":"sanjit061","dn":"November 6,2015 at 02:18pm","view":"0","nu":"hancy061"},{"pid":"23","uf":"hari061","ot":"sanjit061","dn":"November 6,2015 at 01:09pm","view":"0","nu":"hari061"}]}
現在
總之,我的問題是,我可以算的view
總數從jQuery的/ JavaScript的我想要什麼?來計算view
並將該號碼存儲在var
。請注意,這可能不算什麼大事。有沒有什麼辦法可以從jquery/javascript中計算出view
?幫助需要的人。
你可以'JSON_decode'並遍歷它('的foreach decodedArray AS鍵=>值)'和'計數鍵的出現次數=='view'' – Burki
你可以在回覆中發佈這對我和你都會有好處。 –