initial commit (da)
This commit is contained in:
commit
634dceef57
26 changed files with 2592 additions and 0 deletions
34
amd/src/search.js
Normal file
34
amd/src/search.js
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
define([
|
||||
'jquery','core/ajax','core/templates', 'core/notification'
|
||||
], function($, ajax, templates, notification) {
|
||||
|
||||
function search_timetable(searchstring) {
|
||||
//alert(searchstring);
|
||||
var promises = ajax.call([
|
||||
{ methodname: 'mod_timetable_search', args: { searchstring: searchstring } },
|
||||
]);
|
||||
|
||||
promises[0].done(function(response) {
|
||||
console.log('mod_timetable/search is' + response);
|
||||
templates.render('mod_timetable/searchresult',{searchresults: response}).done(function(html, js) {
|
||||
$('.searchresult').replaceWith(html);
|
||||
templates.runTemplateJS(js);
|
||||
}).fail(notification.exception);
|
||||
}).fail(function(ex) {
|
||||
// do something with the exception
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
initialize: function () {
|
||||
$(document).ready(function () {
|
||||
//alert('Hi there');
|
||||
$(".searchstring").keyup(function() {
|
||||
search_timetable($(this).val());
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue