{{^searchresults}}Keine Treffer{{/searchresults}}
{{# js }} require([ 'jquery','core/ajax','core/templates', 'core/notification' ] , function($, ajax, templates, notification) { function load_timetable(type, name, add) { //alert(searchstring); var promises = ajax.call([ { methodname: 'mod_timetable_get', args: { type: type, name: name, week: 0 } }, ]); if (add=='1') { promises[0].done(function(response) { console.log('mod_timetable/get is' + response); templates.render('mod_timetable/timetable',response).done(function(html, js) { $('.timetable').last().after(html); templates.runTemplateJS(js); }).fail(notification.exception); }).fail(function(ex) { // do something with the exception }); } else { promises[0].done(function(response) { console.log('mod_timetable/get is' + response); templates.render('mod_timetable/timetable',response).done(function(html, js) { $('.timetable').first().replaceWith(html); templates.runTemplateJS(js); }).fail(notification.exception); }).fail(function(ex) { // do something with the exception }); } } $(".searchresults").click(function() { load_timetable($(event.target).data('type'),$(event.target).data('name'),$(event.target).data('add')); }); }); {{/ js }}