Skip to content

bootstrap-typeahead.js getting data from external JSON file or python flask view #49

@Chitrank-Dixit

Description

@Chitrank-Dixit

Hello I have seen all the examples of the library it is really nice, but I am unable to fetch data from external JSON file or my flask view.

I am able to get Typeahead all working in this

$('#demo1').typeahead({
        source: [
            { id: 1, name: 'Toronto' },
            { id: 2, name: 'Montreal' },
            { id: 3, name: 'New York' },
            { id: 4, name: 'Buffalo' },
            { id: 5, name: 'Boston' },
            { id: 6, name: 'Columbus' },
            { id: 7, name: 'Dallas' },
            { id: 8, name: 'Vancouver' },
            { id: 9, name: 'Seattle' },
            { id: 10, name: 'Los Angeles' }
        ]
    });

but I need the source data to be fetched from external json or URL
like in the documentation listed

$('#demo4').typeahead({
        ajax: '/cities/list'
    });

I am putting my sample.json file in /cities/list/sample.json .but it is not showing the expected results. Even the working examples listed does not use effective JSON. What to do to enable external JSON.

I have asked this question on SO also here is the link please have a look
http://stackoverflow.com/questions/19895916/bootstrap-typeahead-js-fetch-json-from-a-file-or-remote-source

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions