Display two column from JSON using AJAX in jQuery auto complete in a table format

Display two column from JSON using AJAX in jQuery auto complete in a table format

Currently working on jQuery auto complete where I can able to generate data from JSON single column data, but I want two values should be displayed label and descirption

this is my json

  1. [{"id":"Emirates College of Technology- UAE","label":"COL000001","value":"COL000001"}, {"id":"Al Khawarizmi nternational ollege- UAE","label":"COL000002","value":"COL000002"}, {"id":"Syscoms ollege","label":"COL000003","value":"COL000003"}, {"id":"Abounajm Khanj Pre-Uni enter","label":"COL000004","value":"COL000004"}, {"id":"Advanced lacement","label":"COL000005","value":"COL000005"}, {"id":"Al Buraimi College Uni Clge)","label":"COL000006","value":"COL000006"}, {"id":"Al-Ain Community ollege","label":"COL000007","value":"COL000007"}, {"id":"AMA Computer ollege","label":"COL000008","value":"COL000008"}, {"id":"Arab Academy for Bankg nd Fin","label":"COL000009","value":"COL000009"}, "id":"ARABACDSCITECHMARTIMETRNS","label":"COL0000010","value":"COL0000010"}, "id":"Arapahoe Community College","label":"COL0000011","value":"COL0000011"}, {"id":"Other","label":"Other","value":"Other"}]

Here is my jquery code

  1. $("#scl_name").autocomplete({ highlightClass: "bold", source: function( request, response ) { var regex = new RegExp(request.term, 'i'); //var filteredArray = filteredArray.slice(0,10); $.ajax({ url: "json/dummy.json", dataType: "json", data: {term: request.term}, success: function(data) { response($.map(data, function(item) { if(regex.test(item.label)){ var html=""; html += "<table>"; html += " <tr>"; html += " <td>"+addslashes(item.label)+"</td>"; html += " <td>"+addslashes(item.id)+"</td>"; html += " </tr>"; html += "</table>"; return { value: html }; } })); }, }); }, select: function(event, ui) { $('#school_Name').val(ui.item.id); } }); }); function addslashes(string) { return string.replace(/\\/g, '\\\\'). replace(/\u0008/g, '\\b'). replace(/\t/g, '\\t'). replace(/\n/g, '\\n'). replace(/\f/g, '\\f'). replace(/\r/g, '\\r'). replace(/'/g, '\\\''). replace(/"/g, '\\"'); }

With this above code I am getting the data, but if I select any data from the drop down, I am getting entire table rather than the value

what I am doing wrong here?