-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.js
More file actions
39 lines (28 loc) · 992 Bytes
/
Copy pathmenu.js
File metadata and controls
39 lines (28 loc) · 992 Bytes
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
38
39
$(function() {
if($('#resultat').attr('data-hidden') == 'false') {
$('#resultat').attr('data-hidden', 'true');
}
function get_recipes(type) {
$('#resultat').text('');
$.get('menu.php', {type : type}, function(data) {
for(var i in data["repas"]) {
var repas = data["repas"][i];
if($('#resultat').attr('data-hidden') == 'true') {
$('#resultat').attr('data-hidden', 'false');
}
$('#resultat').append('<div class="repas" id="'+repas['id']+'"><h2><a href="'+repas['lien']+'">'+repas['nom']+'</a></h2><p>'+repas['type']+'</p><p>'+repas['temps_preparation']+'</p></div>');
$('#resultat').css('background','url(../images/'+repas['image']+') no-repeat center center');
$('.salt').toggle();
$('.sugar').toggle();
}
});
}
$('#salt-search').submit(function(ev){
ev.preventDefault();
get_recipes('Plat');
});
$('#sugar-search').submit(function(ev){
ev.preventDefault();
get_recipes('Dessert');
});
});