How to display remote results with Twitter Typeahead?

Detection score: 5.0

<p>I have a similar problem.
I create this ajax function to get response from my server:</p>

<pre><code>var res = function parseResult(query,response)
    type: "post",
    url: "users/search_user",
    data: 'query=' + query,            
    dataType: "html",
    type: "POST",
    success: function (result) {
        result = $.parseJSON(result)
        response( $.map( result, function( item ) {
            return item;

        } ) );


<p>I'm using the following script with twitter typeahead:</p>

        { minLength: 1 },
        { source:res}

<p>and this is my html code:</p>

<pre><code>&lt;label class="demo-label"&gt;Search:&lt;/label&gt; &lt;input type="text" name="country" class="typeahead" /&gt;

<p>the "map" function works fine, but the response variable not set the list of items and then the typeahead function not append the results. what am I doing wrong?</p>
Posted 11 days ago | reported 11 days ago
Posted by Luca Colombini (1)

Caught by 3 reasons: