javascript - Diacritics in autocomplete -
i working on real estate website poland.
i have search section autocomplete function refresh search results when user stops typing.
everything works fine when type non-accent city name, "warszawa".
the problem is, when type word accent, such "kraków". autocomplete finds marker on map, until don't type letter "ó". when type word without accent - "krakow", script still can't find marker on map.
i've been thinking how solve couple of hours, , can't make work.
my website check out here: http://ultimate.houser.pl/nieruchomosci/
my code is:
function getpredictions(request, response){ tmplist = []; if (typeof $.gomap.map === 'object') { $.gomap.predictions.getquerypredictions({ input: 'polska, ' + request.term }, function(predictions, status){ ( = 0; < predictions.length; i++) { place_req = { placeid: predictions[i].place_id }; $.gomap.places.getdetails( place_req, function(place, status){ miasto='', woj='', ulica=''; ( = 0; < place.address_components.length; i++) { addresstype = place.address_components[i].types[0]; if (addresstype == 'administrative_area_level_1') { woj = ', ' + place.address_components[i].long_name; }; if (addresstype == 'locality') { miasto = '' + place.address_components[i].long_name; }; if (addresstype == 'route') { ulica = ', ' + place.address_components[i].long_name; }; } // val = miasto + woj + ulica; if (woj != '') { val = miasto + woj; }; if ( tmplist.indexof(val) < 0 && val.length > 0) { val = val.replace(/województwo/i,'').trim(); // val.replace(',',''); tmplist.push(val); response(tmplist); }; }); } }); } }
it's not issue of autocomplete(it returns results, otherwise wouldn't see in dropdown).
the problem: when test list of markers( div.where
) against value of input#search-where
remove diacritics input-value
ajax_search.js?ver=4.4.1 line 227
= removediacritics( $("#search-where").val() );
but don't remove diacritics innerhtml of div.where
you must either remove diacritics both sides or leave them are.
Comments
Post a Comment