This repository has been archived on 2025-04-04. You can view files and clone it, but cannot push or open issues or pull requests.
2016-04-18 01:43:35 +02:00

84 lines
2.4 KiB
JavaScript

function init_guide(){
rate_click_1();
rate_click_2();
rate_click_3();
rate_click_4();
new_comment_click();
}
function rate_click_1(){
$('#vote_class_1').click(function(){
var rating = 1;
var guide = $('#guide_tag').attr('guide');
$.getJSON('./api.php?call=guides&action=rate&rating=' + rating + '&guide=' + guide, function(data) {
var items = [];
if(data.status == true){
alert("success");
system.reload();
} else {
alert(data.result.message);
}
});
});
}
function rate_click_2(){
$('#vote_class_2').click(function(){
var rating = 2;
var guide = $('#guide_tag').attr('guide');
$.getJSON('./api.php?call=guides&action=rate&rating=' + rating + '&guide=' + guide, function(data) {
var items = [];
if(data.status == true){
alert("success");
system.reload();
} else {
alert(data.result.message);
}
});
});
}
function rate_click_3(){
$('#vote_class_3').click(function(){
var rating = 3;
var guide = $('#guide_tag').attr('guide');
$.getJSON('./api.php?call=guides&action=rate&rating=' + rating + '&guide=' + guide, function(data) {
var items = [];
if(data.status == true){
alert("success");
system.reload();
} else {
alert(data.result.message);
}
});
});
}
function rate_click_4(){
$('#vote_class_4').click(function(){
var rating = 4;
var guide = $('#guide_tag').attr('guide');
$.getJSON('./api.php?call=guides&action=rate&rating=' + rating + '&guide=' + guide, function(data) {
var items = [];
if(data.status == true){
alert("success");
system.reload();
} else {
alert(data.result.message);
}
});
});
}
function new_comment_click(){
$('#new_comment_send').click(function(){
var text = $('#new_comment_textarea').val();
var guide = $('#guide_tag').attr('guide');
alert(text);
$.getJSON('./api.php?call=guides&action=comment&text=' + text + '&guide=' + guide, function(data) {
var items = [];
if(data.status == true){
alert("success");
system.reload();
} else {
alert(data.result.message);
}
});
});
}