Close

Useful links for Apartment Hunters in Europe

(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-TMDM435'); function getPlacePredictions(term, cb) { var sessionToken = new google.maps.places.AutocompleteSessionToken(); var autocompleteService = new google.maps.places.AutocompleteService(); autocompleteService.getPlacePredictions( { input: term, sessionToken: sessionToken, types: ['(cities)'], }, cb ); }; function redirectToSearch(term) { console.log(redirectToSearch); var localisationServiceUrl = 'https://hl-localisation-production.services.thehomelike.com/public/'; jQuery.get( localisationServiceUrl + 'geocoder?to=coordinates&address=' + encodeURIComponent(term), function(cordinateResponse) { var coordinates = cordinateResponse.data; jQuery.get( localisationServiceUrl + 'geocoder?to=address&latitude=' + coordinates.latitude + '&longitude=' + coordinates.longitude + '&include_components=1', function(response) { window.location.href = 'https://www.thehomelike.com/search/' + response.data.components.country + '/' + response.data.components.city; } ); } ); }; jQuery(document).ready(function() { var searchInput = jQuery('#search_form #form-field-search-content'); jQuery( '#search_form' ).on('submit_success', function(){ redirectToSearch(searchInput.val()); }); searchInput.on('keydown', function(e) { if ( jQuery(this).data('acShown') && e.which == 13){ e.preventDefault(); } }); try { searchInput.autocomplete({ source: function (request, response) { setTimeout(function () { searchInput.data('acShown', true); getPlacePredictions( request.term, function(predictions, status) { if (predictions && predictions.length) { var data = []; for (var idx=0;idx<predictions.length;idx++) { data.push(predictions[idx].description); } response(data); } } ); }, 300); }, close: function() { searchInput.data('acShown', false); }, select: function(event, ui) { redirectToSearch(ui.item.value); } }); } catch { } });

Looking for your next