I'm not very good at JavaScript (yet!) - I really need help to get past this stuck point that causes me a lot of premature hair loss!
I just can't figure out how to generate the following HTML using JSON data.
This is the sample JSON data that I created for the new version of this page I'm working on:
[{"id":"1732","name":"1BR House","checkin":"2012-12-20","checkout":"2012-12-23","inclean_cleaner":"","inclean_datetime":"0000-00-00 00:00:00","inclean_notes":""},{"id":"1587","name":1BR House","checkin":"2012-12-23","checkout":"2013-01-01","inclean_cleaner":"","inclean_datetime":"0000-00-00 00:00:00","inclean_notes":""},{"id":"1661","name":"2BR Studio","checkin":"2012-12-25","checkout":"2013-01-02","inclean_cleaner":"","inclean_datetime":"0000-00-00 00:00:00","inclean_notes":""},{"id":"1829","name":"Studio Cottage","checkin":"2012-12-25","checkout":"2012-12-29","inclean_cleaner":"","inclean_datetime":"0000-00-00 00:00:00","inclean_notes":""},{"id":"1787","name":"Studio Cottage","checkin":"2012-12-29","checkout":"2013-01-08","inclean_cleaner":"","inclean_datetime":"2012-12-29 00:00:00","inclean_notes":""},{"id":"1843","name":"1BR House","checkin":"2013-01-07","checkout":"2013-01-19","inclean_cleaner":"","inclean_datetime":"0000-00-00 00:00:00","inclean_notes":""},{"id":"1970","name":"Studio Cottage","checkin":"2013-01-12","checkout":"2013-01-19","inclean_cleaner":"","inclean_datetime":"0000-00-00 00:00:00","inclean_notes":""},{"id":"1942","name":"Suite","checkin":"2013-01-15","checkout":"2013-01-20","inclean_cleaner":"","inclean_datetime":"0000-00-00 00:00:00","inclean_notes":""}]
To illustrate the HTML result I need, here is how I do it now without JSON (strictly in PHP):
<div class="'.$dashboard_list_line_class.'"> <div class="dashboard_list_unitname"> <a href="add-edit.php?bookingID='.$booking_id.'">'.$unit_name.'</a></div> <div class="dashboard_list_cleaner_datetime"> <a href="add-edit.php?bookingID='.$booking_id.'">'.$inclean_datetime.'</a></div> <div class="dashboard_list_cleaner_checkin"> <a href="add-edit.php?bookingID='.$booking_id.'">'.$checkin.'</a></div> <div class="dashboard_list_cleaner_checkout"> <a href="add-edit.php?bookingID='.$booking_id.'">'.$checkout.'</a></div> <div class="dashboard_list_cleaner_inclean_cleaner"> <a href="add-edit.php?bookingID='.$booking_id.'">'.$inclean_cleaner.'</a></div> <div class="dashboard_list_cleaner_notes"> <a href="add-edit.php?bookingID='.$booking_id.'">'.$inclean_notes.'</a></div> </div>
What would the code look like in jQuery or JavaScript to capture JSON, iterate through arrays and produce the same result as PHP I showed? I have worked for several hours and get different data processing results, but I just can't get it to work.
Thank you for your help!