Fix: uniformize function (ready)
This commit is contained in:
parent
f99d5a687c
commit
9c330663c7
@ -148,23 +148,8 @@ function ajax_multiautocompleter($htmlname,$fields,$url,$option='')
|
|||||||
|
|
||||||
jQuery("input#'.$htmlname.'").autocomplete({
|
jQuery("input#'.$htmlname.'").autocomplete({
|
||||||
source: function( request, response ) {
|
source: function( request, response ) {
|
||||||
jQuery.get("'.$url.($option?'?'.$option:'').'", { '.$htmlname.': request.term }, function(data){
|
jQuery.getJSON( "'.$url.($option?'?'.$option:'').'", { '.$htmlname.': request.term }, response );
|
||||||
response( jQuery.map( data, function( item ) {
|
},
|
||||||
if (data.length == 1) {
|
|
||||||
jQuery("#'.$htmlname.'").val(item.value);
|
|
||||||
for (i=0;i<length;i++) {
|
|
||||||
if (item[fields[i]]) {
|
|
||||||
jQuery("#" + fields[i]).val(item[fields[i]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
label: item.label,
|
|
||||||
value: item.value
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}, "json");
|
|
||||||
},
|
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
minLength: 2,
|
minLength: 2,
|
||||||
select: function( event, ui ) {
|
select: function( event, ui ) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user