Get user ip with jquery
问题 I want to get the user's IP address with jQuery or JavaScript, it doesn't really matter but I prefer jQuery. I've seen some answers here but they didn't work for me. 回答1: This has been taken from How to get client IP address using jQuery $.getJSON("http://jsonip.appspot.com?callback=?", function(data){ alert( "Your ip: " + data.ip); }); 回答2: That isn't exposed to javascript, but if you really need it you could spit it out in your markup (assuming php): <head> <meta name="ip" content="<?php