Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,153,825 members, 7,820,901 topics. Date: Wednesday, 08 May 2024 at 01:19 AM |
Nairaland Forum / Science/Technology / Programming / Please I Need Help From A Good Javascript Programmer (706 Views)
Lets Start A Real Web-deveopment Course Here Html+css+javascript+php+mysql / Were Can I Download Free Video Tutorials On Javascript Or Ruby / My Web Development Consultancy Thread(html, CSS, Javascript, Jquery, ASP.NET) (2) (3) (4)
(1) (Reply)
Please I Need Help From A Good Javascript Programmer by Weezyval(m): 11:31pm On Jun 29, 2015 |
please i need help...who can help me loop through this json object, i want to loop through the daily object using javascript but am having some difficulties. my code success: function(json) { console.log(json); $("#current_temp".html(Math.round(json.currently.temperature)+"°F" $("#current_summary".html(json.currently.summary); $("#current_temp".attr("data-icon",icons[json.currently.icon]+" " $("#timezone".html(json.timezone); var newDate = new Date(); newDate.setTime(json.currently.time*1000); dateString = newDate.toUTCString(); document.getElementById("time".innerHTML = newDate; for ( var i = 0; i < daily.data.length; i++) { var DOM = jQuery('#DOM'); var obj = data[i]; console.log(obj); DOM.append("<li>"+obj.summary+"<li>" }; }, error: function(e) { console.log(e.message); } I will be very gratefull if anyone can help me out. Thanks the json object from the callback function Object { latitude: 41.879003, longitude: -87.63675, timezone: "America/Chicago", offset: -5, currently: Object, minutely: Object, hourly: Object, daily: Object, alerts: Array[1], flags: Object } the json Daily data structure(They are 8 in number) The second image is an expanded view of one of the daily object
|
Re: Please I Need Help From A Good Javascript Programmer by IamGodzilla: 1:36pm On Jun 30, 2015 |
I don't really understand how your code is, because of the way it's formatted. But looking at the photo you attached. to loop through an array [], you do this.
And to loop through an object {}, you do this.
This is just an example of how you would loop. you probably are looping through an object using the array format. Also where you have daily.data.length, try daily.data[i], however I would recommend you save it to a variable,
1 Like |
Re: Please I Need Help From A Good Javascript Programmer by Weezyval(m): 9:49am On Jul 02, 2015 |
IamGodzilla:ok' thanks a lot I appreciate |
(1) (Reply)
Robots, Drones And Heart-detectors: How Disaster Technology Is Saving Lives / 7 Essential Improvements In Magento Commerce Cloud / Digital Marketing Consultant
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 14 |