Wunderground can be integrated using differend kind of methods.
You have provide two separated ones: one from PHP and another from JavaScript. Both are equivalent, but implemented in different technologies.
Javascript
You can use JavaScript snipplet to load forecast on-the-fly. This way you have to insert fetched data in DOM hierarchy in place, where you need it. Replace your alert() call with something more appropriate. E.g.:
$("#weather").empty().append ("Current temperature in " + location + " is: " + temp_f);
You should create block/inline-element with "weather" id somewhere in document:
<div id="weather">Loading forecast...</div>
PHP
Another way is to insert weather data from PHP side. This way you should output forecast directly into div:
<div id="weather"><?php "Current temperature in ${location} is: ${temp_f}\n"; ?></div>