Pārlūkot izejas kodu

Implementing API in JS

Md Mozahidur Rahman 1 gadu atpakaļ
vecāks
revīzija
373c3ea521
1 mainītis faili ar 22 papildinājumiem un 23 dzēšanām
  1. 22 23
      page-template/page-conference.php

+ 22 - 23
page-template/page-conference.php

@@ -166,29 +166,28 @@ get_header(); ?>
 
 
     <script>
-        // var myHeaders = new Headers();
-        // myHeaders.append("Content-Type", "application/json");
-
-        // var raw = JSON.stringify({
-        //     "employee_id": "",
-        //     "year": "",
-        //     "user_login_id": "api_user",
-        //     "auth_token": "api_user20230419045143",
-        //     "page": 1,
-        //     "limit": 3
-        // });
-
-        // var requestOptions = {
-        //     method: 'POST',
-        //     headers: myHeaders,
-        //     body: raw,
-        //     redirect: 'follow'
-        // };
-
-        // fetch("http://103.109.52.3/webapi/api/EmployeeJournal", requestOptions)
-        //     .then(response => response.text())
-        //     .then(result => console.log(result))
-        //     .catch(error => console.log('error', error));
+        var myHeaders = new Headers();
+        myHeaders.append("Content-Type", "application/json");
+
+        var raw = JSON.stringify({
+            "employee_id": "",
+            "user_login_id": "api_user",
+            "auth_token": "api_user20230419045143",
+            "page": 1,
+            "limit": 3
+        });
+
+        var requestOptions = {
+            method: 'POST',
+            headers: myHeaders,
+            body: raw,
+            redirect: 'follow'
+        };
+
+        fetch("http://103.109.52.3/webapi/api/EmployeeJournal", requestOptions)
+            .then(response => response.text())
+            .then(result => console.log(result))
+            .catch(error => console.log('error', error));
     </script>