程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> js-從服務器獲得這種數據之後,如何分別取出來進行處理?

js-從服務器獲得這種數據之後,如何分別取出來進行處理?

編輯:編程綜合問答
從服務器獲得這種數據之後,如何分別取出來進行處理?

[["2015-06-05 16:21:40","666"], ["2015-06-05 15:30:38","666"], ["2015-06-05 15:07:26","666"], ["2015-06-05 14:38:21","666"], ["2015-06-05 14:38:21","666"], ["2015-06-05 14:33:18","666"], ["2015-06-05 14:23:18","666"], ["2015-06-05 14:18:16","666"], ["2015-06-05 14:15:09","666"], ["2015-06-05 14:12:16","666"], ["2015-06-05 14:12:16","666"], ["2015-06-05 14:05:34","666"], ["2015-06-05 14:01:27","666"], ["2015-06-05 13:57:44","666"], ["2015-06-05 13:57:44","666"], ["2015-06-05 13:51:23","666"], ["2015-06-05 13:51:23","666"], ["2015-06-05 13:41:43","666"],]

(1)如何將這些數據取出來放到一個數組裡?
(2)如何將單個的數據:["2015-06-05 13:41:43","666"]以“,”分隔取出來,例如:我要取出後面這個數據“666”

最佳回答:


轉為json對象就可以操作了,建議你最好將最後那個“,”去掉,搞標准點

     var s = '[["2015-06-05 16:21:40","666"], ["2015-06-05 15:30:38","666"], ["2015-06-05 15:07:26","666"], ["2015-06-05 14:38:21","666"], ["2015-06-05 14:38:21","666"], ["2015-06-05 14:33:18","666"], ["2015-06-05 14:23:18","666"], ["2015-06-05 14:18:16","666"], ["2015-06-05 14:15:09","666"], ["2015-06-05 14:12:16","666"], ["2015-06-05 14:12:16","666"], ["2015-06-05 14:05:34","666"], ["2015-06-05 14:01:27","666"], ["2015-06-05 13:57:44","666"], ["2015-06-05 13:57:44","666"], ["2015-06-05 13:51:23","666"], ["2015-06-05 13:51:23","666"], ["2015-06-05 13:41:43","666"],]';
    var o = eval('(' + s + ')');
    for (var i = 0; i < o.length; i++)
        alert(o[i][0] + '\n' + o[i][1]);
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved