I am making an autocomplete search bar using codeigniter, i am getting data through ajax call, the data is coming in an array as i checked it using the command print_r(). The data is coming in array.
Now in ajax data is also coming in console.log, here is my code of ajax:
$(document).ready(function(){
$('#country_id').keyup( function() {
var min_length = 0;
var keyword = $('#country_id').val();
if (keyword.length >= min_length) {
$.ajax({
url: 'http://localhost/new/index.php/travels/search_fields',
type: 'POST',
data: { term: $("#country_id").val()},
success:function(data){
console.log(data);
}
});
}
});
});
Now I want to show that data in a drop down below the input field. What should i do now? Please help me out.