You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.1 KiB
JavaScript
47 lines
1.1 KiB
JavaScript
7 years ago
|
$("#user").easyAutocomplete({
|
||
|
url: "action.php",
|
||
|
ajaxSettings: {
|
||
|
dataType: "json",
|
||
|
method: "GET",
|
||
|
data: {
|
||
|
action: "autocomplete_user"
|
||
|
}
|
||
|
},
|
||
|
preparePostData: function (data) {
|
||
|
data.q = $("#user").val();
|
||
|
return data;
|
||
|
},
|
||
|
getValue: function (element) {
|
||
|
return element.username;
|
||
|
},
|
||
|
template: {
|
||
|
type: "custom",
|
||
|
method: function (value, item) {
|
||
|
return item.name + " <i class=\"small\">" + item.username + "</i>";
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$("#perm").easyAutocomplete({
|
||
|
url: "action.php",
|
||
|
ajaxSettings: {
|
||
|
dataType: "json",
|
||
|
method: "GET",
|
||
|
data: {
|
||
|
action: "autocomplete_permission"
|
||
|
}
|
||
|
},
|
||
|
preparePostData: function (data) {
|
||
|
data.q = $("#perm").val();
|
||
|
return data;
|
||
|
},
|
||
|
getValue: function (element) {
|
||
|
return element.name;
|
||
|
},
|
||
|
template: {
|
||
|
type: "custom",
|
||
|
method: function (value, item) {
|
||
|
return item.name + " <i class=\"small\">" + item.info + "</i>";
|
||
|
}
|
||
|
}
|
||
|
});
|