Hi.  I'm using jquery version 1.4.2 and jquery ui version 1.8rc3.  I
can't get the autocomplete to work.  Here is my HTML:

<html>
<head>
        <META http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
        <META name="GENERATOR" content="IBM Software Development Platform">
        <META http-equiv="Content-Style-Type" content="text/css">
        <meta http-equiv="Pragma" content="no-cache">
        <meta http-equiv="Cache-Control" content="no-cache">

        <title>Pick a City</title>

        <script type="text/javascript" src="/JavaScript/jquery-ui-
autocomplete/js/jquery-1.4.2.min.js"></script>
        <script type="text/javascript" src="/JavaScript/jquery-ui-
autocomplete/js/jquery-ui-1.8rc3.custom.min.js"></script>
        <link rel="stylesheet" href="/JavaScript/jquery-ui-autocomplete/css/
smoothness/jquery-ui-1.8rc3.custom.css">

        <script language="JavaScript">
            $(document).ready(function()
                {
                        var blank="";
                        $('#city').focus();

                        $('#city').autocomplete({
                                source: function(request, response) {
                                        $.ajax({
                                                url: "CITPIC02",
                                                datatype: "json",
                                                data: {
                                                        name_startsWith: 
request.term,
                                                        state: 
$('#state').val(),
                                                        maxRows: 15
                                                },

                                                success: function(data) {
                                                        
response($.map(data.cities, function(item) {
                                                                return {
                                                                        label: 
item.label,
                                                                        value: 
item.value
                                                                }
                                                        }))
                                                }
                                        })
                                },
                                minLength: 2
                        });
                });
        </script>
</head>
<body>
        City: <input name="city" id="city" style="width: 230px;"
maxLength="15">&nbsp;&nbsp;
        State:
        <select name="state" id="state">
        </select>
</body>
</html>


And, here is a JSON string that CITPIC02 returns:

{"cities":[{"label":"RIVERSIDE, ","value":"RIVERSIDE"},
{"label":"WILLSBORO, ","value":"WILLSBORO"},{"label":"RIVERSIDE,
","value":"RIVERSIDE"},{"label":"RIVERSIDE, ","value":"RIVERSIDE"},
{"label":"ALBERTA BEACH, AB","value":"ALBERTA BEACH"},{"label":"ACME,
AB","value":"ACME"}]}


I get a JavaScript error that says "a is undefined" and it's referring
to the response in the success function, but I just can't figure out
what's keeping it from working.  I've nearly driven myself mad over
this.  Anyone have any suggestions?

-- 
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to jquery...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-ui+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en.

Reply via email to