Home >Web Front-end >JS Tutorial >JS cannot use jquery to obtain the IP address across domains_javascript skills
Get the IP address. JS can also get the client IP address. Everyone knows that JS cannot cross domain, so with the help of jquery, you can really get the IP address. The code is as follows, and it has passed the test:
<script language="javascript" src="http://www.jb51.net/jslib/jquery/jquery.js"></script> <script language="javascript"> jQuery(function($){ var url = 'http://chaxun.1616.net/s.php?type=ip&output=json&callback=?&_='+Math.random(); $.getJSON(url, function(data){ alert(data.Ip); }); }); </script>