I trying to create a currency converter for my web site based on this example:


This example is pulling the exchange rate data from an API. Documentation for the API can be found here:


If you view the source code for the example and click on link for "files/js/script.js.php" You can see that it has JSON data being retrieved from the API. I don't understand how this example is doing this. I assume is it doing it server side using PHP because of the .php at the end of the file name.

By looking at the documentation provided by the API I can see that I can use the code below to retrieve the data but I am unsure how to assign it to the 'data' variable so that it the data displays like it does in the example.

The data being retrieved comes from this source:


On the documentation it recommends doing something like this:

// Use jQuery.ajax to get the latest exchange rates, with JSONP:
    url: 'http://openexchangerates.org/api/latest.json?app_id=YOUR_APP_ID',
    dataType: 'jsonp',
    success: function(json) {
        // Rates are in `json.rates`
        // Base currency (USD) is `json.base`
        // UNIX Timestamp when rates were collected is in `json.timestamp`


So basically I need to edit the code above to retrieve the data from the source and assign it variable called 'data' so that it displays just like in the example. Now this is probably quite simple to do but my experiences with web development is limited and I have been looking at this for around five hours straight now so I sorry if this is a silly post but I'm desperate for the help, thanks.