Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8194583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:52:27+00:00 2026-06-07T04:52:27+00:00

I need to use typeahead for very large data. Generation of data consumes 4-5

  • 0

I need to use typeahead for very large data. Generation of data consumes 4-5 seconds. So I cannot make Ajax calls each time. I download and cache the data upon user request. My code is the following:

$("#build-package-list-btn").click(function(){
        $.get**JSON**("/packages", function(data){
            // data is an array
            $("#typeahead-packages").typeahead({source:data});
            console.log(data == null); // returns false
        });
    })

It gives no error but whenever I try to write to typeahead text box, it gives me the following error:

Uncaught TypeError: Cannot call method 'toLowerCase' of null bootstrap.js:1644
Typeahead.matcher bootstrap.js:1644
(anonymous function) bootstrap.js:1631
e.extend.grep jquery-1.7.2.min.js:2
Typeahead.lookup bootstrap.js:1630
Typeahead.keyup bootstrap.js:1738
e.extend.proxy.g jquery-1.7.2.min.js:2
f.event.dispatch jquery-1.7.2.min.js:3
f.event.add.h.handle.i jquery-1.7.2.min.js:3

My typeahead is like this (JADE)

input#typeahead-packages(type="text",data-provide="typeahead")

Also in the Chrome Console I tried:

 $("#typeahead-packages").typeahead({source:["abcdef","abcddd","abcccc"]});

But typeahead does not give an error but it also does not work. I cannot find what am I doing wrong. I am using the 2.0.4 bootstrap.

EDIT: I changed it to getJSON from get it did not help. However when I construct data like this, it is working:

data = [new String((data[0])), new String((data[5]))];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:52:28+00:00Added an answer on June 7, 2026 at 4:52 am

    Based on your update, the problem comes from the JSON.

    jQuery.getJSON()

    Important: As of jQuery 1.4, if the JSON file contains a syntax error, the request will usually fail silently.
    (source)

    You should concentrate on the source of the items. be sure that this is an array of strings. Your error suggest data is a string.

    You can use the Chrome Console (or any of your choice), under the Network tab, and spy on the actual results of your AJAX request. JSONLint is an interesting tool to validate your result.

    Then your next problem will be to update the source of an already initialized typeahead. You can use the following code :

    var $myTypeahead = $('#myTypeahead');
    var typeaheadObj = $myTypeahead.data('typeahead');
    if(typeaheadObj) typeaheadObj.source = ["abc", "cde"];
    

    Example (jsfiddle)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to the Bootstrap Twitter framework, and I need to use bootstrap-typeahead.js for
I need use this method with three distinct classes: Orders, Customers, Suppliers public void
I need use this code: <%= button_tag :class => btn btn-primary do %> <%=
I have installed Matlab r2010a on my computer I need use the function xlsread
So, I need use this event so I can navigate trought blog posts. I
Need to use own imaged markers instead built-in pins. I have several questions. 1.
I need to use maps on running in a physical Android device, how do
I need to use the objdump and readelf commands in my application that runs
I need to use unix Style line endings (only LF) in Zend Studio 8/9
I need to use the javascript loop variable i in the loop block. for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.