views:

28

answers:

1

I was using this code earlier today and it worked fine, then I apparantly changed something and it doesnt work. ive tried reinstalling jQueryUI but it doesnt help.

<script type="text/javascript">
$(function() {
    function loadpage(webpage) {
        window.location.replace( webpage );
    }

    $("#searchform").autocomplete({
        source: "search.php",
        minLength: 2,
        select: function(event, ui) {
            loadpage(ui.item ? ("http://www.tf2heatmaps.net/maps/" + ui.item.value + "/"));
        }
    });
});
</script>
                <div class="ui-widget">
                <label for="searchform">Search: </label>
                <input id="searchform" class="textbox">
                </div>

search.php returns valid JSON so I don't believe the problem is there.

+1  A: 

You should be getting a missing : in conditional expression as the parameter you give to loadpage is an incomplete shorthand if

In other words you are missing the else part..

Gaby