/ Published in: JavaScript
Get User IP By jQuery Ajax
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function GetUserIP(){ var ret_ip; $.ajaxSetup({async: false}); $.get('//jsonip.com/', function(r){ ret_ip = r.ip; }); console.log(ret_ip) return ret_ip; }