twitter bootstrap typeahead 2.0.4 ajax error

Posted by Adam Levitt on Stack Overflow See other posts from Stack Overflow or by Adam Levitt
Published on 2012-06-24T15:03:50Z Indexed on 2012/06/24 15:16 UTC
Read the original article Hit count: 459

Filed under:
|
|

I have the following code which definitely returns a proper data result if I use the 2.0.0 version, but for some reason bootstrap's typeahead plugin is giving me an error. I pasted it below the code sample:

<input id="test" type="text" />

$('#test').typeahead({
    source: function(typeahead, query) {
        return $.post('/Profile/searchFor', { query: query }, function(data) {                
            return typeahead.process(data);
        });
    }
});

When I run this example I'm getting a jQuery bug that says the following:

**
item is undefined
matcher(item=undefined)bootst...head.js (line 104)
<br/>(?)(item=undefined)bootst...head.js (line 91)
<br/>f(a=function(), b=function(), c=false)jquery....min.js (line 2)
<br/>lookup(event=undefined)bootst...head.js (line 90)
<br/>keyup(e=Object { originalEvent=Event keyup, type="keyup", timeStamp=145718131, more...})bootst...head.js (line 198)
<br/>f()jquery....min.js (line 2)
<br/>add(c=Object { originalEvent=Event keyup, type="keyup", timeStamp=145718131, <br/>more...})jquery....min.js (line 3)
<br/>add(a=keyup charCode=0, keyCode=70)jquery....min.js (line 3)
<br/>[Break On This Error]  
<br/>return item.toLowerCase().indexOf(this.query.toLowerCase())**

Any thoughts? ... The same code works in the 2.0.0 version of the plugin, but fails to write to my knockout object model.

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about twitter-bootstrap