Q:

Typeahead format source

I'm trying to use Typeahead. I'm using AJAX to get my source :
$(document).ready(function() {
        $('input.typeahead').typeahead( 
        {
            hint: true,
            highlight: true,
            minLength: 1
        },
        {                              
            source: function(query, process) {
                jQuery.ajax({
                    url: 'suggestion.php',
                    dataType: "json",
                    data: {
                        type: 'abc'
                    },  
                    success: function(data) {
                        suggestion = [];
                        for(var i in data)
                        {
                            suggestion.push(data[i]);
                        }
                        console.log(data);
                    }
                });
                process(suggestion);
                return suggestion;
            }
        });
    });

But there is the result :

But when I see the logs :

I've an array with strings !
There the console message :

I can see an error appear at the first char typed but only the first time. All the time, I've "undefined" x 5 proposed.
What's the matter ? I guess the format, but I've tried mainly things from stacks, without results (only errors). My Php code return ("echo") an json_encode($array) ! It's my first time using Ajax and Typeahead..
Sorry for my english.

A:

I think that suggestion must be this kind of array :
[{ "value": "CBOXXX" }, { "value": "CBAXXX" }]

