diff --git a/app/static/js/word_operation.js b/app/static/js/word_operation.js index e669655..684d350 100644 --- a/app/static/js/word_operation.js +++ b/app/static/js/word_operation.js @@ -1,7 +1,9 @@ function familiar(theWord) { let username = $("#username").text(); - let word = $("#word_" + theWord).text(); - let freq = $("#freq_" + theWord).text(); + let word = document.getElementById(`word_${theWord}`).innerText; + let freq = document.getElementById(`freq_${theWord}`).innerText; + console.log(theWord); + console.log(word); $.ajax({ type:"GET", url:"/" + username + "/" + word + "/familiar", @@ -27,8 +29,10 @@ function familiar(theWord) { function unfamiliar(theWord) { let username = $("#username").text(); - let word = $("#word_" + theWord).text(); - let freq = $("#freq_" + theWord).text(); + let word = document.getElementById(`word_${theWord}`).innerText; + let freq = document.getElementById(`freq_${theWord}`).innerText; + console.log(theWord); + console.log(word); $.ajax({ type:"GET", url:"/" + username + "/" + word + "/unfamiliar", @@ -95,14 +99,14 @@ function parseWord(element) { */ function wordTemplate(word) { // 这个模板应当与 templates/userpage_get.html 中的

...

保持一致 - return `

+ return `

${word.word} ( ${word.freq} ) - 熟悉 - 不熟悉 - 删除 - 朗读 + 熟悉 + 不熟悉 + 删除 + 朗读 笔记

`; diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index cb29ce8..d3bf8bf 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -179,10 +179,10 @@ {{ word }} ( {{ freq }} ) - 熟悉 - 不熟悉 - 删除 - 朗读 + 熟悉 + 不熟悉 + 删除 + 朗读 笔记