-
Notifications
You must be signed in to change notification settings - Fork 2
/
functions.js
37 lines (33 loc) · 889 Bytes
/
functions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$(function(){
$("#add-term").load("ajax-add-term.php").effect("highlight");
$("#dashboard").load("ajax-dashboard.php").effect("highlight");
});
function term(id){
$("#term").load("ajax-term.php?termID="+ id).effect("highlight");
}
function show_tweets(id){
$("#tweets").load("ajax-show-tweets.php?termID="+ id).effect("highlight");
}
function vote(id,type){
$.ajax({
type: "POST",
url: "ajax-vote.php",
data: "termID=" + id + "&vote=" + type,
success: function(msg){
$(".booth-"+ id).html("thx!").effect("highlight");
}
});
}
$(function(){
$("#find").autocomplete({
source: function(request, response){
$.getJSON("ajax-search.php?term="+ request.term,function (data){
response(data);
});
},
select: function( event, ui ) {
$("#term").load("ajax-term.php?termID="+ ui.item.value).effect("highlight");
$("#find").val(ui.item.label);
}
})
});