Get the App
SLTechnology News&Howtos  ›  Development  › 

How does jQuery obtain Geographic location through IP address

Shulou Source: shulou.com Published: 2022-06-01 04:17:30 10月04日 Update

Editor to share with you how jQuery through the IP address to get the location, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Get the geographic location through the IP address

There are many online services that can tell us the city and country where the IP address is located. Let's first ping to Baidu's IP address, and then get its geographical location:

Var ip = '119.75.218.70', api = 'http://freegeoip.net/json/' + ip +'? callback=?';$.getJSON (api, function (r) {console.log ('How is the weather in' + r.city +','+ r.country_name +'?);}). The above is all the content of the article "how jQuery gets geographical location through IP address". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Address location geography article content not much country online service city most location more knowledge industry information channel channel reference online Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn macOS Apple NVidia Xiaomi