Permalink
Browse files

actually get the current conditions

  • Loading branch information...
1 parent ebeba60 commit a299a35992dc70fd93f4231b106fa82fcf9bb351 @obra committed Jul 31, 2012
Showing with 19 additions and 15 deletions.
  1. +19 −15 app/scripts/plugins/weather.js
View
34 app/scripts/plugins/weather.js
@@ -1,17 +1,21 @@
-define(['plugins/weather'], function () {
- return {
- name: 'weather',
- reply: function(args) {
- return [1, "cloudy"];
- jQuery = args.jQuery;
- var remote_url = 'http://www.google.com/ig/api?weather=San%20Francisco,%20CA';
- var remote = jQuery.ajax({
- type: "GET",
- url: remote_url,
- async: false
- }).responseText;
- return remote;
-
+define(['plugins/weather'], function() {
+ return {
+ name: 'weather',
+ reply: function(args) {
+ jQuery = args.jQuery;
+ var url = 'http://www.google.com/ig/api?weather=San%20Francisco,%20CA';
+
+ jQuery.ajax({
+ url: url,
+ type: 'get',
+ dataType: 'xml',
+ async: false,
+ success: function(data) {
+ output = data.getElementsByTagName("condition")[0].getAttribute("data");
+ }
+ });
+ return [1, output];
}
-}});
+ }
+});

0 comments on commit a299a35

Please sign in to comment.