Connect two laptops through wi-fi
I think what you want is 'ad-hoc'. You can create an ad-hoc network on one device, and connect to this network from the other device. I am assuming both devices have Ubuntu installed; you can follow this steps:
Click the network connections indicator in the upper right corner at your screen:
Choose Edit Connections... and click the Add button at the right in the window opened:
Then select Wi-Fi as the connection type, then press the button Create....
Then in the opened window, set the details as you wish, only thing you have to modify is the SSID, it is the name of the wireless network.
Make sure you selected the Mode as the Ad-hoc.
When you press save the connection will be saved and in a few seconds you should be able connect the other device to the network, too.