diff --git a/app/static/js/word_operation.js b/app/static/js/word_operation.js index dd650f8..a55fb6e 100644 --- a/app/static/js/word_operation.js +++ b/app/static/js/word_operation.js @@ -1,43 +1,43 @@ -function familiar(index) { +function familiar(theWord) { let username = $("#username").text(); - let word = $("#word_" + index).text(); - let freq = $("#freq_" + index).text(); + let word = $("#word_" + theWord).text(); + let freq = $("#freq_" + theWord).text(); $.ajax({ type:"GET", url:"/" + username + "/" + word + "/familiar", success:function(response){ let new_freq = freq - 1; if(new_freq <1) { - $("#p_" + index).remove(); + $("#p_" + theWord).remove(); } else { - $("#freq_" + index).text(new_freq); + $("#freq_" + theWord).text(new_freq); } } }); } -function unfamiliar(index) { +function unfamiliar(theWord) { let username = $("#username").text(); - let word = $("#word_" + index).text(); - let freq = $("#freq_" + index).text(); + let word = $("#word_" + theWord).text(); + let freq = $("#freq_" + theWord).text(); $.ajax({ type:"GET", url:"/" + username + "/" + word + "/unfamiliar", success:function(response){ let new_freq = parseInt(freq) + 1; - $("#freq_" + index).text(new_freq); + $("#freq_" + theWord).text(new_freq); } }); } -function delete_word(index) { +function delete_word(theWord) { let username = $("#username").text(); - let word = $("#word_" + index).text(); + let word = $("#word_" + theWord).text(); $.ajax({ type:"GET", url:"/" + username + "/" + word + "/del", success:function(response){ - $("#p_" + index).remove(); + $("#p_" + theWord).remove(); } }); } diff --git a/app/templates/userpage_get.html b/app/templates/userpage_get.html index 7fb3bb2..8b11365 100644 --- a/app/templates/userpage_get.html +++ b/app/templates/userpage_get.html @@ -68,13 +68,13 @@ {% if session.get('thisWord') == x[0] and session.get('time') == 1 %} {% endif %} -

- + {{ word }} - ( {{ freq }} ) - 熟悉 - 不熟悉 - 删除 + ( {{ freq }} ) + 熟悉 + 不熟悉 + 删除

{% endfor %}