My solution:

Since I'm using PHP 5.2+, I'm able to use the json_encode function
like this:

while($speaker = mysql_fetch_object($speaker_query)){
        $encodable[] = $speaker;
}

$encoded = json_encode($encodable);

echo $encoded;

Then, in the javascript function:

var searchurl = $("#speakerformsearch").attr('action');
                $("#speakersearchinput").autocomplete(searchurl,{
                        dataType: "json",
                        parse: function(data) {
                                        return $.map(data, function(row) {
                                                        return {
                                                                        data: 
row,
                                                                        value: 
row.text
                                                        }
                                        });
                        },
                        formatItem: function(item){
                                return item.Title+" "+item.FirstName+" 
"+item.MiddleName+"
"+item.LastName;
                        },
                        formatResult: function(item){
                                return item.Title+" "+item.FirstName+" 
"+item.MiddleName+"
"+item.LastName;
                        }
                }).result(function(event, item){
                        location.href = "?id="+item.FacultyID;
                });

Works great! On, click of the item in the drop down, it takes me to
the URL. This might be what you want to look into. to solve your
problem.

Reply via email to