{"id":1448,"date":"2025-04-27T19:22:00","date_gmt":"2025-04-27T12:22:00","guid":{"rendered":"http:\/\/localhost\/?p=1448"},"modified":"2025-04-27T19:25:32","modified_gmt":"2025-04-27T12:25:32","slug":"test-vocab","status":"publish","type":"post","link":"https:\/\/studaca.online\/test-vocab\/","title":{"rendered":"test vocab"},"content":{"rendered":"\n<!DOCTYPE html>\n<html lang=\"vi\">\n<head>\n    <meta charset=\"UTF-8\">\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n    <title>Tra c\u1ee9u t\u1eeb v\u1ef1ng<\/title>\n    <style>\n        body { font-family: Arial, sans-serif; margin: 20px; }\n        label, input, button { font-size: 16px; margin: 10px 0; }\n        #result { margin-top: 20px; }\n        .word-result { margin-bottom: 10px; }\n    <\/style>\n<\/head>\n<body>\n    <h1>Tra c\u1ee9u t\u1eeb v\u1ef1ng<\/h1>\n    <form id=\"vocab-form\">\n        <label for=\"sentence\">Nh\u1eadp c\u00e2u:<\/label>\n        <input type=\"text\" id=\"sentence\" name=\"sentence\" required>\n        <button type=\"submit\">T\u00ecm t\u1eeb<\/button>\n    <\/form>\n\n    <div id=\"result\"><\/div>\n\n    <script>\n        document.getElementById('vocab-form').addEventListener('submit', function(e) {\n            e.preventDefault();\n            var sentence = document.getElementById('sentence').value;\n\n            \/\/ G\u1eedi y\u00eau c\u1ea7u POST \u0111\u1ebfn API\n            fetch('http:\/\/localhost\/api\/vocab-api\/v1\/check', {\n                method: 'POST',\n                headers: {\n                    'Content-Type': 'application\/json'\n                },\n                body: JSON.stringify({ sentence: sentence })\n            })\n            .then(response => response.json())\n            .then(data => {\n                var resultDiv = document.getElementById('result');\n                if (data.status === 'success') {\n                    resultDiv.innerHTML = '';\n                    data.results.forEach(function(result) {\n                        resultDiv.innerHTML += `\n                            <div class=\"word-result\">\n                                <strong>T\u1eeb:<\/strong> ${result.word} <br>\n                                <strong>Lo\u1ea1i t\u1eeb:<\/strong> ${result.part_of_speech} <br>\n                                <strong>C\u1ea5p \u0111\u1ed9 CEFR:<\/strong> ${result.cefr_level}\n                            <\/div>\n                        `;\n                    });\n                } else {\n                    resultDiv.innerHTML = `<strong>L\u1ed7i:<\/strong> ${data.message}`;\n                }\n            })\n            .catch(error => {\n                console.error('Error:', error);\n            });\n        });\n    <\/script>\n<\/body>\n<\/html>\n\n","protected":false},"excerpt":{"rendered":"<p>Tra c\u1ee9u t\u1eeb v\u1ef1ng Tra c\u1ee9u t\u1eeb v\u1ef1ng Nh\u1eadp c\u00e2u: T\u00ecm t\u1eeb<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1448","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/studaca.online\/api\/wp\/v2\/posts\/1448","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/studaca.online\/api\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/studaca.online\/api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/studaca.online\/api\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/studaca.online\/api\/wp\/v2\/comments?post=1448"}],"version-history":[{"count":3,"href":"https:\/\/studaca.online\/api\/wp\/v2\/posts\/1448\/revisions"}],"predecessor-version":[{"id":1452,"href":"https:\/\/studaca.online\/api\/wp\/v2\/posts\/1448\/revisions\/1452"}],"wp:attachment":[{"href":"https:\/\/studaca.online\/api\/wp\/v2\/media?parent=1448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/studaca.online\/api\/wp\/v2\/categories?post=1448"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/studaca.online\/api\/wp\/v2\/tags?post=1448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}