C to F function for AJAX pages

Another function suggestion to those of you using the AJAX Carter Lake template on how to clean up your scripts.

Instead of doing the math here:

temp = (1.8 * x.responseText.split(' ')[4]) + 32.0;

create a function and add it to the top of the AJAX script section

function convertCtoF(celcius) // Take temperature value in Metric (Celcius) // and convert to Fahrenheit { return (1.8 * celcius) + 32.0; }

then whenever you need to convert, just use the function. For example:

temp = convertCtoF(x.responseText.split(' ')[4]);

Since you have to use this conversion several times on your page for temps and trends, it’s a cleaner approach.