Hello,

I am having problem in the javascript that prints the autocomplete fields. I am passing the array of values to the javascript function to display in the form, but I do not see any dropdown.
This is the javascript I have used

The code for passing the array of values to the javascript function is as follows
Code:
function get_Names() {
            // Convert the string to the lowercase
            $q = strtolower($this->input->post('q', TRUE));
            print_r($this->input->post());
            if(!$q) {
                //return;
            }
            $tagnames[] = $this->autocomplete_model->getData();
            
            echo json_encode($tagnames);
}
Code:
<script type="text/javascript">
    $(document).ready(function() {
	$(function() {
            $( "#tagname" ).autocomplete({
                source: function(request, response) {
                    $.ajax({
                        url: "<?php echo site_url('generator/get_Names'); ?>",
                        data: {term: $("#tagname").val()},
                        datatype: "json",
                        type:"POST",
                        success: function(data) {
                            response(data);
                        }
                    });
                },
                minlenght:2
            });
        });
    });
</script>