1$(function(){ 2 3 $('#clubname').autocomplete({ 4 5 source: function(request, response){ 6 7 $.ajax({ 8 9 url: $('#clubname').parents('form').attr('data-rel-href') + '/ajax/registration/clubs.autosuggest.php', 10 dataType: 'json', 11 12 data: { 13 club_startsWith: request.term, 14 type: 'club', 15 club: $('#playerSearchClub').val() 16 }, 17 18 success: function(data){ 19 20 response($.map(data, function(item){ 21 return { 22 label: item.clubname + ' (' + item.clubprovince + ')', 23 value: item.clubname, 24 id: item.clubid 25 } 26 })); 27 28 }, 29 30 error: function(data){ 31 } 32 33 }); 34 35 }, 36 37 autoFocus: true, 38 minLength: 3, 39 40 select: function (event, ui){ 41 42 if (!ui.item) { 43 44 this.value = ''; 45 $('#clubid').val(''); 46 47 } else { 48 49 var $id = ui.item.id; 50 var $label = ui.item.label; 51 52 $('#clubid').val($id); 53 54 } 55 56 }, 57 58 change: function (event, ui){ 59 60 if (!ui.item) { 61 62 this.value = ''; 63 $('#clubid').val(''); 64 65 } else { 66 67 var $id = ui.item.id; 68 var $label = ui.item.label; 69 70 $('#clubid').val($id); 71 72 } 73 } 74 75 }); 76 77});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.