You cannot use localhost for access to another computer. It's a loopback address of the network card which means, in this case, you will be redirected to the local computer if you try to use it.
Since you're connected to the same modem you should be on the same network.
You have to use the IP address or setup a DNS record for the computer with xampp installed and access it through that.
PC1 IP address: 192.168.0.10
PC2 IP address: 192.168.0.20
Configure apache to allow access from 192.168.0.20 in the
Browse to http://192.168.0.10/ or for example http://192.168.0.10/phpmyadmin, from PC2.
You could also allow network access to the
htdocs\ folder on PC1 and access it from PC2 by typing into explorer or run prompt
\\192.168.0.10\htdocs\that way to modify files or folders.
Not neccesary but easier than typing in IP addresses:
If you have DNS on your modem you can configure an A-record for it there or you could simply go to the
%WINDIR%\system32\drivers\etc\ folder on PC2 and configure the hosts file with a record pointing to 192.168.0.10(PC1).
More reading on networking: