jQuery AJAX Geolocation Not Working -


i using freegeoip's api location of visitor. have tried putting code in $(document).ready (without click event) , in click event in both cases, seems though ajax call doesn't run. i've got code shopify's webpage since it's jquery, should work in cases jquery.

here's fiddle

here's javascript code :

jquery(document).ready(function(){      jquery('button').click(function(){         jquery.ajax( {            url: 'http://freegeoip.net/json/',            type: 'post',            datatype: 'jsonp',           success: function(location) {             jquery('#location').append(location.country_code);           }         } );     }); }); 

here's simple html :

<button type="button">button</button> <div id="location"></div> 

does have idea went wrong? i've spent hours checking couldn't spot obvious problems. i've tried using api , $.getjson never work. there no error message in console. wish run after page load , upon success, execute other functions.

thanks helping.

so problem identified. it's adblockplus has blocked freegeoip.net, that's why doesn't work on computer (and have plugin installed browsers).

hope helps facing similar issues.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -