43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
|
function familiar(index) {
|
||
|
var username = $("#username").text();
|
||
|
var word = $("#word_" + index).text();
|
||
|
var freq = $("#freq_" + index).text();
|
||
|
$.ajax({
|
||
|
type:"get",
|
||
|
url:"/" + username + "/" + word + "/familiar",
|
||
|
success:function(resp){
|
||
|
var new_freq = freq - 1;
|
||
|
if(new_freq <1) {
|
||
|
$("#p_" + index).remove();
|
||
|
} else {
|
||
|
$("#freq_" + index).text(new_freq);
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function unfamiliar(index) {
|
||
|
var username = $("#username").text();
|
||
|
var word = $("#word_" + index).text();
|
||
|
var freq = $("#freq_" + index).text();
|
||
|
$.ajax({
|
||
|
type:"get",
|
||
|
url:"/" + username + "/" + word + "/unfamiliar",
|
||
|
success:function(resp){
|
||
|
var new_freq = parseInt(freq) + 1;
|
||
|
$("#freq_" + index).text(new_freq);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function del_word(index) {
|
||
|
var username = $("#username").text();
|
||
|
var word = $("#word_" + index).text();
|
||
|
$.ajax({
|
||
|
type:"get",
|
||
|
url:"/" + username + "/" + word + "/del",
|
||
|
success:function(resp){
|
||
|
$("#p_" + index).remove();
|
||
|
}
|
||
|
});
|
||
|
}
|