Forecast.io using Time argument with JSONP not working -


my plan display past 3 days of various weather stats user unable use time argument properly. here code:

var forecasturl = "https://api.forecast.io/forecast/api_key/".concat(lat,lng,new date().toisostring().replace("z","-72:00"));                 $.ajax({                     url: forecasturl,                     jsonp: "callback",                     datatype: "jsonp",                     success: function(response) {                         console.log(response);                     }                 }); 

i'm not sure i'm doing date right i'm getting warning saying getdefaultprevent deprecated. else @ fault or date? if it's date, what's proper structure manipulating iso 8601 strings in past? preferrably 7 days if possible.

firstly, in use concat not return commas between values, code below uses + "," + method rather create variable need if wanted use concat.

secondly, in iso timestamps, ie:

2015-05-25t20:56:15.179z 

the z means utc offset of time zero. can replaced +1000 times in utc + 10 hours. if wish change time value utc offset not place it.

var d = new date(); d.sethours(d.gethours()-72);  var forecasturl = "https://api.forecast.io/forecast/api_key/" + lat + "," + lng + "," + d.toisostring(); //your existing ajax call go here 

you replace gethours , sethours getdate , setdate or of other js date functions.

i can't test json part of question don't have api key looks should work. find more info json in jquery here.


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -