mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
23 lines
554 B
JavaScript
23 lines
554 B
JavaScript
$(document).ready(function() {
|
|
$(".autocomplete-json").each(function() {
|
|
var field = $(this)
|
|
$.getJSON($(this).data('valueurl'), function(json) {
|
|
field.val(json[0]['fields']['name']);
|
|
});
|
|
var source = $(this).data('sourceurl');
|
|
$(this).autocomplete({
|
|
source: source,
|
|
minLength: 3,
|
|
focus: function(e, ui) {
|
|
e.preventDefault();
|
|
$(this).val(ui.item.label);
|
|
|
|
},
|
|
select: function(e, ui) {
|
|
e.preventDefault();
|
|
$(this).val(ui.item.label);
|
|
$("#"+$(this).data('target')).val(ui.item.value)
|
|
},
|
|
});
|
|
});
|
|
}); |