views:

40

answers:

0

Hi -- I'm trying to add a function that will display when the AJAX is working, as well as when there are no results. In additionn, when there are many results, I'd like for there to be a link at the bottom of the dropdown to click to see the full search results page. My current code looks like this:

<script>
            jQuery(document).ready(function(){
                    jQuery("#aut_field").autocomplete("/livesearch", {
                            width: 250,
                            max: 10,
                            delay: 10,
                            cacheLength: 1000,
                            highlight: false,
                            scroll: false,
                            scrollHeight: 400,
                            deferRequestBy: 0,
                            selectFirst: false,
                            highlight: function(match,keywords) {
                                    keywords = keywords.split(' ').join('|');
                                    return match.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + keywords + ")(?![^<>]*>)(?![^&;]+;)", "gi"), '<span class="search_match">$1</span>');
                            },
                            formatItem: function(data, i, n, value) {
                                    var newarray = value.split("=");
                                    var title = newarray[1].toString();
                                    var titleLength = title.length;
                                    var year = title.substring(0,4);
                                    if (parseInt(year)) {
                                            title = "<strong>ROLL:</strong> " + title;
                                    }
                                    if (titleLength > 1) {
                                            return "<div class=\"search_image\"><img src=\"" + newarray[0] + "\"  width=\"60\" height=\"34\" /></div><div class=\"search_title\">" + title + "</div>";
                                    } else {
                                    }
                            },
                            formatResult: function(data, value) {
                                    var newarray = value.split("=");
                                    return "\"" + newarray[1] + "\"";
                            },
                    }).result(function(event, value) {        
                                            var urlarray = value.toString().split("=");
                                            location.href = urlarray[2];
                            });

; });

I'm not sure how to add that functionality given the above functions.

/livefunction current returns a newline separated string in the form of "http://www.example.com/img.jpg=TITLE=http://www.example.com/url"

Thank you.