Bhushan Dafale Bhushan Dafale - 2 months ago 11x
HTML Question

How can i get json key and value from autocomplete response in separate textbox. please see image

enter image description here

Please see images you will understand...this image taken from chrome development tool, i am printing JSON response on console.

Following is autocomplete code...

width: 300,
max: 10,
delay: 100,
minLength: 1,
autoFocus: true,
cacheLength: 1,
scroll: true,
highlight: false,
source: function(request, response) {
url : "../../SearchHelperController",
contentType : "application/json; charset=utf-8",
dataType : 'json',
type : 'GET',
cache : false,
data: {
searchKeyword: request.term,
searchType: $("#byName").val()
success: function(data, textStatus, jqXHR) {
error: function(jqXHR, textStatus, errorThrown){
console.log( textStatus);

select: function (event, ui) {


html code..

<div class="radio">
<label><input type="radio" id="byName" name="byName" value="OU" checked> By Name</label>
<input type="text" id="org-id">
<div class="form-group">
<input type="text" class="form-control" id="search-org">


to get an object keys, simply write:

var keys = Object.keys(data);

this will give you an array of the keys for this object. to access them use

keys.forEach(function(key) {