First, make sure you have a good connection. Ideally, you'll want to be connected to a strong Wi-Fi signal, but a stable cellular data connection will work too.
Check your internet connection through another app. If pages in Safari will load quickly, for example, then clearly your internet connection is fine.
If your iPhone or iPad won't connect to any internet signal, try putting your phone into Airplane Mode and taking it out. If that fails, restart your device. If even that doesn't work, you should reset your device's network settings.
Open the iPhone or iPad's Settings app and tap "General," then tap "Reset" near the bottom of the next page. Now tap "Reset Network Settings" and then enter your passcode.
Note that this will erase all the Wi-Fi passwords saved on your device.
If your Wi-Fi signal isn't working on any device, you might simply need to restart your router.