jquery - Javascript Geo Redirection not working -
my code gives blank page. no redirection occurs
<script src="http://code.jquery.com/jquery-latest.js"></script> <script language='javascript'> $.getjson( "http://smart-ip.net/geoip-json?callback=?", function(data){ if (data.countrycode == "ca") { window.location = 'canada.php'; } else { window.location = 'usa.php'; } </script>
you script missing termination code.
place });
right before </script>
.
so code should this...
<script src="http://code.jquery.com/jquery-latest.js"></script> <script language='javascript'> $.getjson( "http://smart-ip.net/geoip-json?callback=?", function(data){ if (data.countrycode == "ca") { window.location = 'canada.php'; } else { window.location = 'usa.php'; } }); </script>
Comments
Post a Comment