---
updatedAt: 2025-07-15T09:21:30.000Z
agentTools:
  projectIndex: https://docs.appery.io/llms.txt
---

# Weather API and Geolocation jQM Sample App

Sample apps with backend services.

This example​ uses Weather REST API to show the temperature information based on your location.

Sample app uses and demonstrates:

* jQuery Mobile.
* Server Code.
* Invoking an external REST API.

# App (UI)

To get the app UI:

1. Create a new jQuery Mobile app based on the **Blank** template.
2. Inside the App Builder, select **CREATE NEW > From plugin**. Under **Appery.io Examples** select **Weather API with Geolocation**.
3. Click the **Import selected plugin** button.
4. Select **Weather** as the starter page and click **Apply settings**.

# Backend

To get the app backend:

1. Go to the **[Server Code](https://appery.io/servercode/)** page.
2. Open the **[Plugins](https://appery.io/servercode/plugins)** page.
3. Import the **WeatherUnderground** plugin. Open the imported script, it should look like this:

```javascript Weather Server Code script
var apiKey = "Quickly check weather conditions for a location.";
var location = request.get("location");
var url = "http://api.wunderground.com/api/"+apiKey+"/conditions/q/"+location+".json";

var XHRResponse = XHR2.send("GET", url, {});
Apperyio.response.success(XHRResponse.body, "application/json");
```

4. You need to sign up for a **Weather Underground Developer** account to get an API key. Once you have the API key, set it on line 1 in the script. How to [find the API key](http://help.wunderground.com/knowledgebase/articles/656767-where-is-my-api-key)?
5. If you would like to test the script before using it in the app open the **Script parameters** tab. Create a parameter called ***location*** and set its value to an airport, for example, &#x200B;***JFK***.
6. Switch to the **Run** tab and click the **Save and run** button.

# Connecting the UI and the Backend

The last step is to connect the app with the backend.

1. In **Server Code**, open the **API information** tab.
2. From **Service URL**, copy the script ID.
3. Inside the App Builder, **open Services > WeatherAPI\_service**.
4. In service URL, replace ***\{servercode}*** with the ID from step #2 (the curly brackets are not needed).
5. Now you can test the app by clicking the **Test** button in the toolbar.