I'm trying to make a voice weather system with voiceXML and the Yahoo Weather API. To develop my program I'm using voxeo evolution.
To call the Weather API I'm using the data
vxml tag with an srcexpr
because I need a dynamic URL (the program asks the user for a city to check weather in).
Here is my code:
<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1">
<form id="mainMenu">
<field name="City">
<prompt>
Please, name a spanish city.
</prompt>
<grammar src="city.grammar"/>
</field>
<!-- code taken from the javascript example of the yahoo weather api -->
<script>
<![CDATA[
var callbackFunction = function(data) {
var wind = data.query.results.channel.wind;
alert(wind.chill);
};
]]>
</script>
<data srcexpr="https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where woeid in (select woeid from geo.places where text='"+City+", spain')&callback=callbackFunction"/>
</form>
</vxml>
The program doesn't work because of the data
tag to connect to the weather API, but I don't know why. Do someone know why is failing?