Location.country_code from freegeoip.net - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:jQuery Method Example

Description

Location.country_code from freegeoip.net

Demo Code

ResultView the demo in separate window

<!doctype html>
<html>
   <head></head>
   <body> 
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script> 
      <script type="text/javascript">
  $(document).ready(function() {
      $.getJSON('http://freegeoip.net/json/?callback=?', function(location) {
            console.log( location.country_name );
       });/*from   w  w w. java  2 s  . c o m*/
  });

      </script>  
   </body>
</html>

Related Tutorials