Post Project
  • Search
    • Buyers can
    • Search offers to buy now
    • Search freelancers to request a proposal
    • Freelancers can
    • Search projects to quote on
  • How it works
  • Log in
  • Sign up
  • Freelancer?
Categories
    Technology & ProgrammingWriting & TranslationDesignDigital MarketingVideo, Photo & ImageBusinessMusic & AudioMarketing, Branding & SalesSocial Media
Technology & ProgrammingWriting & TranslationDesignDigital MarketingVideo, Photo & ImageBusinessMusic & AudioMarketing, Branding & SalesSocial Media

Changing data source of Typeahead.js

- or -

Post a project like this
1244
€150(approx. $182)
  • Posted: 3 years ago
  • Proposals: 6
  • Remote
  • #1694701
  • Awarded
Kashyap A.
Kashyap A.
Senior Full-Stack Developer
India Ahmedabad
HawksCode T.
HawksCode T.
Website & S/W Development, Mobile Apps, ERP, IT Consulting, SEO
Top Endorsed
India Delhi
Kuldip S.
Kuldip S.
Front End Developer and ECommerce expert.
India Nagar
Swapan D.
Swapan D.
Full stack Web Developer, Software Developer, Programmer
Bangladesh Dhaka
Wilco T.
Wilco T.
NodeJS / Angular / PHP Web Developer
Philippines Quezon
Lakhvinder S.
Lakhvinder S.
Full Stack Developer
India Mohali
10758724558551470014172698818115311815860
Kashyap A.
HawksCode T.Kuldip S.Swapan D.Wilco T. + 1 other have already sent a proposal.
  • 1
  • 1

Description

Experience Level: Intermediate
General information for the website: Mapping website
Description of requirements/features: We need to change the source of the Typeahead from the select event. For example, when a user enters a query and a list of suggestions are shown, then on selecting one of the items we need to change the url of the source and get a different set of data based on the user's selection.

for example: if we have the following, pleased look at the case statements 1 & 2 where we would want to get different data based on user selection. Please note: Once we change the daya source and present user with the new options, on selection of an item from the new list we need to go back and set the data source back to the original one.

The use caase is say the typeahead is initialised with datasource that shows Countrues. The user select a country - We go to datastore and get the towns for that country the user selected and set the source to the town that were returned and show the dropdown menu to the user.

If the user either selects a town from the dropdown OR starts retyping in the typeahead input - we need to reset the typeahead source back to the Country dataset.

$('#typeahead').typeahead({
hint: true,
highlight: true,
minLength: 1

},
{
name: 'addresses',
display: 'Value',
source: function (query, process, asyncProcess) {
var cont = $('#Country').val().toLowerCase();
$.get('/api/AddressLookup?cont=' + 'IE' + "&prefix=" + query, function (data) {
asyncProcess(data);
});
},
limit: 10,
templates: {
empty: [
'',
'No Matches Found',
' 0) {

switch (suggestion.Flag) {
case 1:
**change url and parameters**
case 2:
**change url and parameters**
case 3:

case 4:

case 5:

case 6:

}

}


});
Extra notes:
Hassan N.
Hassan N.
100% (5)
Projects Completed
5
Freelancers worked with
5
Projects awarded
41%
Last project
1 Jul 2020
Ireland

New Proposal

Login to your account and send a proposal now to get this project.

Log in

Clarification Board Ask a Question

    There are no clarification messages.
1244
€150(approx. $182)

- or -

Post a project like this
Hassan N.
Hassan N.
100% (5)
Projects Completed
5
Freelancers worked with
5
Projects awarded
41%
Last project
1 Jul 2020
Ireland

Related project Searches


application programming interface (API) database web

Product

  • About
  • Team
  • Careers
  • Blog

Support

  • How it works
  • Trust & Safety
  • Help Centre

Discover

  • Plus Works
  • Academy

Resources

  • Customer Stories
  • Business Cost Calculator
  • Startup Cities

Browse

  • Freelance Services
  • Freelance Services By Country
  • Freelance Skills
  • Terms
  • Privacy
  • © 2021 People Per Hour Ltd
We use cookies to improve your experience and our services. By using PeoplePerHour, you agree to ourCookie Policy