change in multilingual
[wolnelektury.git] / wolnelektury / static / js / widgetInit.js
1         $(function() {          
2                 $("#id_qq").autocomplete({
3                         source: function(request, response) {
4                                 $.ajax({
5                                         url: "http://www.wolnelektury.pl/katalog/jtags/",
6                                         dataType: "jsonp",
7                                         data: {
8                                                 featureClass: "P",
9                                                 style: "full",
10                                                 maxRows: 10,
11                                                 q: request.term
12                                         },
13                                         success: function(data) {
14                                                 response($.map(data.matches, function(item) {
15                                                         return {
16                                                                 label: item,
17                                                                 value: item
18                                                         }
19                                                 }))
20                                         }                                       
21                                 })
22                         },
23                         minLength: 2,
24             select: function(event, ui) {
25                 $("#id_qq").val(ui.item.value);
26                 $("#wl-form").submit();
27             }                   
28                 });
29         });