<script type="text/javascript">
    $(document).ready(function(){
        //autocomplete for organism search
        $("#search_{{ type }}").autocomplete({
            position: {
                my: "right top", at: "right bottom"
            },
            source: function (request, response) {
                var search = request.term;
                $.ajax({
                    url: "{{ path('api', {'namespace': 'listing', 'classname': 'organisms'}) }}",
                    data: {term:  request.term, limit: 500, search: search, dbversion: '{{ dbversion }}'},
                    dataType: "json",
                    success: function (data) {
                        response(data);
                    }
                });
            },
            minLength: 3
        });

        $("#search_{{ type }}").data("ui-autocomplete")._renderItem = function (ul, item) {
            var li = $("<li>")
                    .append("<a href='/organism/details/byId/'+item.organism_id><span style='display:inline-block; width: 100%; font-style: italic;'>" + item.scientific_name + "</span><span style='color: #338C8C'>" + item.rank + "</span></a>")
                    .appendTo(ul);
            return li;
        };

        $("#btn_search_{{ type }}").click(function(){
            var searchTerm = $("#search_{{ type }}").val();
            var resultPage = Routing.generate('{{ type }}_result', {'dbversion': '{{ dbversion }}', 'limit': 500, 'search': searchTerm});
            window.location.href = resultPage;
        });
    });
</script>
<script type="text/javascript">
    $(document).ready(function(){
        //autocomplete for organism search
        $("#search_{{ type }}").autocomplete({
            position: {
                my: "right top", at: "right bottom"
            },
            source: function (request, response) {
                var search = request.term;
                $.ajax({
                    url: "{{ path('api', {'namespace': 'listing', 'classname': 'organisms'}) }}",
                    data: {term:  request.term, limit: 500, search: search, dbversion: '{{ dbversion }}'},
                    dataType: "json",
                    success: function (data) {
                        response(data);
                    }
                });
            },
            minLength: 3
        });

        $("#search_{{ type }}").data("ui-autocomplete")._renderItem = function (ul, item) {
            var details = Routing.generate('{{ type }}_details', {'dbversion': '{{ dbversion }}', 'organism_id': item.organism_id});
            var li = $("<li>")
                    .append("<a href='"+details+"'><span style='display:inline-block; width: 100%; font-style: italic;'>" + item.scientific_name + "</span><span style='color: #338C8C'>" + item.rank + "</span></a>")
                    .appendTo(ul);
            return li;
        };

        $("#btn_search_{{ type }}").click(function(){
            var searchTerm = $("#search_{{ type }}").val();
            var resultPage = Routing.generate('{{ type }}_result', {'dbversion': '{{ dbversion }}', 'limit': 500, 'search': searchTerm});
            window.location.href = resultPage;
        });
    });
</script>
Fix quicksearch link to organism page
Fix quicksearch link to organism page
