[eluser]Unknown[/eluser]
how to make the autocomplete input to the database from the previous result is a province becomes propinsi_id ...
Code:
$(this).ready( function() {
$("#propinsi_id").autocomplete({
minLength: 1,
source:
function(req, add){
$.ajax({
url: "<?php echo base_url(); ?>index.php/autocomplete/lookup",
dataType: 'json',
type: 'POST',
data: req,
success:
function(data){
if(data.response =="true"){
add(data.message);
}
},
});
},
select:
function(event, ui) {
$("#result").append(
"<li>"+ ui.item.id + "</li>"
);
},
});