hasib
hasib

Reputation: 1

Why isn't my javascript from weather channel working?

I need to use the following code for a block in drupal-

<script type="text/javascript" src="http://voap.weather.com/weather/oap/BGXX0003?template=LAWNV&par=3000000007&unit=1&key=twciweatherwidget"></script>

Please someone help me how i should write the code. I have tried in php. But are not working.

<?php
<script type="text/javascript" src="http://voap.weather.com/weather/oap/BGXX0003?template=LAWNV&par=3000000007&unit=1&key=twciweatherwidget"></script>
?>

or

<?php
 drupal_add_js('<script type="text/javascript" src="http://voap.weather.com/weather/oap/BGXX0003?template=LAWNV&par=3000000007&unit=1&key=twciweatherwidget"></script>', 'inline');
?>

The javascript block is being used on a panel

Upvotes: 0

Views: 520

Answers (2)

user3503686
user3503686

Reputation: 1

It may be The Weather Channel that is the problem.

My Website (MinnesotaSeasons.com) uses this on all Destination pages. In the last 30 days they have been working only sporadically. Mostly, they just do not load. Before this there was no problem. The code has not changed. Only the results.

Here is the code I use for one of the destinations. It does not work this morning. It has in the past.

<script type="text/javascript" src="http://voap.weather.com/weather/oap/55372?template=GENXV&amp;par=3000000007&unit=0&key=twciweatherwidget"></script>

Upvotes: 0

markkes
markkes

Reputation: 56

You should use external, also the script tags are not needed. Try the following:

<?php drupal_add_js('http://voap.weather.com/weather/oap/BGXX0003?template=LAWNV&par=3000000007&unit=1&key=twciweatherwidget', 'external'); ?>

More info about the drupal_add_js function at: https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_add_js/7

Upvotes: 1

Related Questions