Browse Source

object array operation done

night-cherry 1 tháng trước cách đây
mục cha
commit
73b87eff1a
1 tập tin đã thay đổi với 5 bổ sung2 xóa
  1. 5 2
      index.js

+ 5 - 2
index.js

@@ -95,7 +95,7 @@ const app=createApp({
         console.log("--------parse tomcat server string--------");
         const res=JSON.parse(request.responseText);
 
-        _tomcat_res=res[1].title;
+        _tomcat_res=res[0].title;
         console.log("res:"+res);
         console.log("res[0].title :"+res[0].title);
         console.log("res[0].author :"+res[0].author);
@@ -112,7 +112,10 @@ const app=createApp({
         console.log("------  _books : "+_books);
         // console.log("------this.books : "+this.books);
         try{
-          _books.concat(res);
+          for(item in res){
+            _books.push(item);
+          }
+          // _books.concat(res);
         }catch(e){
           console.log("the way == _books.push(res[0])  is wrong!!!");
           try{