GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — APIJSON-Demo/APIJSON-JavaScript/APIJSON-JS/get/array.html at master · j3com/APIJSON-Demo Expand file tree/ Copy patharray.htmlMore file actions 52 lines (42 loc) · 1.31 KB / Copy patharray.htmlFile metadata and controls52 lines (42 loc) · 1.31 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>GET:Array</title> <script type="text/javascript" src="../RequestUtil.js"></script> </head> <body> <script > //单对象数组请求的简单方式 var rq = getArray("User", { "name$":"%o%" }, 5, 1, false, callBack); //普通方式<<<<<<<<<<<<<<<<<<<<<<<<<< // var json = { // "User[]":{ // "count":5, // "page":1, // "User":{ // "name$":"%o%" //已通过encode函数自动转义 encodeURIComponent("%o%") // } // } // }; // // var rq = request(URL_GET, json, false, callBack); /**回调函数 */ function callBack() { var rp = JSON.parse(rq.responseText); alert("Response:\n" + format(JSON.stringify(rp))); var arr = rp == null ? null : rp["User[]"]; //取出数组User[] if (arr != null) { alert("User[].length = " + arr.length); var user0 = arr == null || arr.length <= 0 ? null : arr[0]; //取出User[]第0项 if (user0 != null) { alert("User[]/0 = \n" + format(JSON.stringify(user0))); alert("User[]/0/id = " + user0.id); //取出并显示User[]第0项User的id alert("User[]/0/name = " + user0.name); //取出并显示User[]第0项User的name } } } </script> </body> </html> |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |