Get User IP By jQuery Ajax


/ Published in: JavaScript

Get User IP By jQuery Ajax


Copy this code and paste it in your HTML
  1. function GetUserIP(){
  2. var ret_ip;
  3. $.ajaxSetup({async: false});
  4. $.get('//jsonip.com/', function(r){
  5. ret_ip = r.ip;
  6. });
  7. console.log(ret_ip)
  8. return ret_ip;
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.