Javascript doesn't provide a library out-the-box. Even if you use extensions, you'd get the IP at the client, which isn't necessarily useful (e.g. At home my machine has IP 102.168.0.2, but this is the IP address on
my network, and many other users will have the same IP on their own network. This isn't such a problem if you are on a network without aub-nets (i.e. the IPs are unique, which may be the case on an intranet.
More likely you want the IP of the request at the server. On the controller these will prove useful:
var foo = Request.UserHostName;
var bar = Request.UserHostAddress;
IIRC, you have to fail over, so if the UserHostName isn't resolved you defer to the UserHostAddress. Note that even this causes problems: Let's say there are two devices on my home network (192.168.1.2 and 192.168.1.3), we access your site via our common broadband router, we both appear as the same address. Worse my home router's address might change if it expires, as might similarly the internal addresses of the two devices so even these IPs are not necessarily enough.
A common solution to this problem is to provide a tracking cookie with a GUID and storing the request IP and the session GUID alongside eachother, though again you are going to have problems if the user deletes their cookies or disables them.