Quellcode durchsuchen

Implementing API in JS

Md Mozahidur Rahman vor 1 Jahr
Ursprung
Commit
373c3ea521
1 geänderte Dateien mit 22 neuen und 23 gelöschten Zeilen
  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>