Hello guys, I have a textbox, i want to autocomplete it , but seem it's not work.
window.onload = function () {
load_text();
}
function load_text() {
$.ajax(
{
type: "POST",
url: "../BUS/WebService.asmx/LIST_DEPARTMENT",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
var valuetextbox = [];
$.each($.parseJSON(data.d), function (idx, obj) {
valuetextbox.push(obj.DEPARTMENT_NAME);
});
$('#txt_textbox').autocomplete({
source: valuetextbox
});
},
error: function (data) {
alert("HTML Error Load");
}
});
}
This is data consolelog
Object {d: "[{"DEPARTMENT_ID":"D00000000001","DEPARTMENT_NAME"…"2015-05-05T00:00:00","EDIT_BY":"","FLAG":false}]"}
d: "[{"DEPARTMENT_ID":"D00000000001","DEPARTMENT_NAME":"HR","DEPARTMENT_DES":"HR","EDIT_DATE":"2015-05-05T00:00:00","EDIT_BY":"","FLAG":false},{"DEPARTMENT_ID":"D00000000002","DEPARTMENT_NAME":"ACCOUNT","DEPARTMENT_DES":"ACCOUNT","EDIT_DATE":"2015-05-05T00:00:00","EDIT_BY":"","FLAG":false}]"
__proto__: Object
Thank guys.