{"id":28,"date":"2024-11-04T19:44:52","date_gmt":"2024-11-05T00:44:52","guid":{"rendered":"https:\/\/zhangweb.ca\/anli\/?page_id=28"},"modified":"2024-12-14T09:51:14","modified_gmt":"2024-12-14T14:51:14","slug":"student","status":"publish","type":"page","link":"https:\/\/zhangweb.ca\/anli\/student\/","title":{"rendered":"students"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Customer Data Search<\/title>\n<\/head>\n<body>\n    <h1>Customer Data Search<\/h1>\n    \n    <!-- \u8868\u5355\u90e8\u5206 -->\n    <form id=\"searchForm\">\n        <label for=\"id1\">Enter Student ID:<\/label>\n        <input type=\"text\" id=\"id1\" name=\"id1\" required>\n        <br><br>\n        <label for=\"id2\">Enter Father ID:<\/label>\n        <input type=\"text\" id=\"id2\" name=\"id2\" required>\n        <br><br>\n        <button type=\"submit\">Search<\/button>\n    <\/form>\n    \n    <!-- \u5c55\u793a\u6570\u636e\u7684\u8868\u683c -->\n    <h2>Results:<\/h2>\n    <table id=\"customerTable\" border=\"1\">\n        <thead>\n            <tr>\n                <th>Student ID<\/th>\n                <th>Father ID<\/th>\n                <th>Student Name<\/th>\n                <th>Email<\/th>\n                <th>Age<\/th>\n            <\/tr>\n        <\/thead>\n        <tbody>\n            <!-- \u6570\u636e\u884c\u5c06\u52a8\u6001\u63d2\u5165 -->\n        <\/tbody>\n    <\/table>\n\n\n\n    <script>\n        \/\/ \u5904\u7406\u8868\u5355\u63d0\u4ea4\n        document.getElementById('searchForm').addEventListener('submit', function(event) {\n            event.preventDefault(); \/\/ \u9632\u6b62\u8868\u5355\u63d0\u4ea4\u5bfc\u81f4\u9875\u9762\u5237\u65b0\n\n            const id1 = document.getElementById('id1').value;\n            const id2 = document.getElementById('id2').value;\n\n            \/\/ \u6784\u5efa API \u8bf7\u6c42 URL\n            const apiUrl = `https:\/\/script.google.com\/macros\/s\/AKfycbyQ5tIWrdlzY4miQtBEBvrEPjeY84Nvump8tXtrP_cniPbJn4hhFihUEwaCrMZu7imRKg\/exec?id1=${id1}&id2=${id2}`;\n\n            \/\/ \u53d1\u9001\u8bf7\u6c42\u5230 API\n            fetch(apiUrl)\n                .then(response => response.json()) \/\/ \u89e3\u6790\u8fd4\u56de\u7684 JSON \u6570\u636e\n                .then(data => {\n                    \/\/ \u6e05\u7a7a\u8868\u683c\u5185\u5bb9\n                    const tableBody = document.querySelector('#customerTable tbody');\n                    tableBody.innerHTML = '';\n\n                    \/\/ \u68c0\u67e5\u662f\u5426\u6709\u6570\u636e\n                    if (data.length === 0) {\n                        const noDataRow = document.createElement('tr');\n                        noDataRow.innerHTML = '<td colspan=\"5\">No matching records found.<\/td>';\n                        tableBody.appendChild(noDataRow);\n                        return;\n                    }\n\n                    \/\/ \u5c06\u7ed3\u679c\u63d2\u5165\u5230\u8868\u683c\u4e2d\n                    data.forEach(item => {\n                        const row = document.createElement('tr');\n                        row.innerHTML = `\n                            <td>${item.id1}<\/td>\n                            <td>${item.id2}<\/td>\n                            <td>${item.name}<\/td>\n                            <td>${item.email}<\/td>\n                            <td>${item.age}<\/td>\n                        `;\n                        tableBody.appendChild(row);\n                    });\n                })\n                 .catch(error => {\n                    console.error('Error fetching data:', error);\n                    alert('There was an error fetching data. The page will now refresh.');\n                    location.reload(); \/\/ \u5237\u65b0\u9875\u9762\n                });\n        });\n    <\/script>\n<\/body>\n<\/html>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Customer Data Search Customer Data Search Enter Student ID: Enter Father ID: Search Results: Student ID Father ID Student Name [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-28","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/zhangweb.ca\/anli\/wp-json\/wp\/v2\/pages\/28","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhangweb.ca\/anli\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/zhangweb.ca\/anli\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/zhangweb.ca\/anli\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zhangweb.ca\/anli\/wp-json\/wp\/v2\/comments?post=28"}],"version-history":[{"count":23,"href":"https:\/\/zhangweb.ca\/anli\/wp-json\/wp\/v2\/pages\/28\/revisions"}],"predecessor-version":[{"id":116,"href":"https:\/\/zhangweb.ca\/anli\/wp-json\/wp\/v2\/pages\/28\/revisions\/116"}],"wp:attachment":[{"href":"https:\/\/zhangweb.ca\/anli\/wp-json\/wp\/v2\/media?parent=28"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}