title: How can I geo target ads/banners with javascript?
body: <p>Do you know of any way to do it? real example...?</p>
  
  <p>I am looking for a free service like maxmind or others (I really don't care what) and I would like to have a different ad for US visitors.</p>
  
  <p>Thanks a lot!</p>
  
  <p>2astalavista: Your example works fine. This is what I did and it's still not working.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Geo Test&lt;/title&gt;
  &lt;script type='text/javascript' src='http://www.101greatgoals.com/wp-includes/js/jquery/jquery.js?ver=1.7.1'&gt;&lt;/script&gt;
  &lt;script&gt;
  $(document).ready( function() {
      $.getJSON( "http://smart-ip.net/geoip-json?callback=?",
          function(data){            
              console.log(data);
              var c = data.countryCode;
              if(c=="US" || c=="US" ){
                  document.getElementById('ddd').innerHTML = 'US'; } else {
                      document.getElementById('ddd').innerHTML = 'Not US';}
              /*
              this service needs ip
              var ip = data.host;
              alert(ip);
              $.getJSON( "http://freegeoip.net/json/"+ip,
                  function(data){
                      console.log(data);
                  }
              );*/
          }
      );
  
  });?
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div id="ddd"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Don't know if it's the server (amazon) or the CDN (cotendo)....</p>