title: Cache JSON response
body: <p>I using some GeoIP service to place country flag on pages depends on country IP. And I need to cache JSON response for all pages on my site.</p>
  
  <p>This code placed into <code>header.php</code>:</p>
  
  <pre><code>$.getJSON('http://smart-ip.net/geoip-json?callback=?', function(data) {
    $('#flag').html("&lt;a class='fancybox-inline int' href='#international'&gt;&lt;img src='/images/flags/"+data.countryCode+".png'&gt;&lt;/a&gt;");
    }
  </code></pre>
  
  <p>Is it possible to cache it with <code>$.ajaxSetup({ cache: true })</code>? - seems to not work.</p>
  
  <p>Or probably better to use HTML5 localStorage, but I'm not sure how to do that.</p>
  
  <p>I also tried <a href="https://github.com/kpuputti/JSONCache" rel="nofollow">JSONCache</a> plugin, but it did not work for me. </p>