You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$(document).on('input','#location',function(e){$.ajax({url: '<?php echo $sm['config']['site_url']; ?>worldcities.json',dataType: 'json',// Corrected dataTypesuccess: function(citiesData){// Extract city names from the datavarcityNames=[];varcityDataMap={};// Map to store city data by namecitiesData.forEach(city=>{constcityName=city.city_ascii.toLowerCase();cityNames.push(cityName);cityDataMap[cityName]={latitude: city.lat,longitude: city.lng,country: city.country,cityName: city.city};});// Initialize the autocomplete functionality on the input field$('#location').autocomplete({source: function(request,response){// Filter the cities based on user inputconstterm=request.term.toLowerCase();constfilteredCities=cityNames.filter(city=>city.includes(term));response(filteredCities);},minLength: 1,select: function(event,ui){console.log('click event triggered =>',ui,event);// Get the selected city// const selectedCityName = $('#loc').val(); constselectedCityName=ui.item.value;console.log('selectedCityName =>',selectedCityName);// Find the city in the mapconstselectedCityData=cityDataMap[selectedCityName];console.log(selectedCityData);if(selectedCityData){varlat=selectedCityData.latitude;varlng=selectedCityData.longitude;varcity=selectedCityData.cityName;varcountry=selectedCityData.country;message=userId+','+lat+','+lng+','+city+','+country;$.ajax({url: request_source()+'/api.php',data: {action: "updateLocation",query: message},type: "get",dataType: "JSON",success: function(response){// Handle success response as needed},error: function(error){console.error('Error updating location:',error);}});}// Update the input fields with the selected city's information$('#locality').val(selectedCityData.cityName);$('#lat').val(selectedCityData.latitude);$('#lng').val(selectedCityData.longitude);$('#country').val(selectedCityData.country);}});},error: function(error){console.error('Error loading city information:',error);}});})
this is the code its working fine in desktop but not in mobile when i click with mouse it does not work but when i use arrow to slect and press enter then it works but not in select please help me out with this
Thanks for the report. Does the issue you describe exist when jQuery UI 1.12.1 is used or only with jQuery UI 1.13.0 or newer?
Also, a minimal isolated test case would help. This one is not minimal, it has a lot of superfluous code; please spend some time on minimizing it if you want to increase chances your issue will be addressed.
this is the code its working fine in desktop but not in mobile when i click with mouse it does not work but when i use arrow to slect and press enter then it works but not in select please help me out with this
EDIT by @mgol: code formatting fixed
The text was updated successfully, but these errors were encountered: