Вы можете настроить функцию Ajax Get из Jquery .., чтобы получить очки человека
, тогда вы можете проверить, показывают ли очки человека больше 10 ... что-то еще, показывают предупреждение ..
Пример:
if (confirm("Are you sure you want an answer? It will deduct 10 points.")) {
$.ajax({
type: "post",
url: "@Url.Content("~/")API/PointsTransaction/PointsTransactAnswer",
contentType: "application/json; charset=utf-8",
success: function(obj) {
// let make * Ppoints * is person points that we have gitten from Ajax
if (Ppoints > 10 ) {
// show the answer
}else {
alert("oops, you don't have enough points to show this answer")
}
}
});
}
, а также .. вы можете использовать Jquery для создания функции, когда нажимаете кнопку.
$(document).ready(function() {
$('#answer').click(function() {
// what to do if the button clicked
})
})
надеюсь, я вам помог!и извините за мой плохой английский.