So far i have this but it doesn't seem to work.
$.get("museums.php",function(data,status){
var response='';
//console.log(data);
var json = $.parseJSON(data);
museums = json.museums;
for(let m in museums) { $("#names-list").append("<p>" + museums[m].museum_name)
+ $("#desc-list").append("<p>" + museums[m].museum_description )
+ $("#address-list").append("<p>" + museums[m].address )
+ $("#type-list").append("<p>"+ museums[m].museum_type )
+ $("#list").append("<p>"+ museums[m].postcode )
+ $("#list").append("<p>"+ museums[m].website )
+ $("#list").append("<p>"+ museums[m].opening_hours )
+ $("#list").append("<p>"+ museums[m].closed_days )
+ $("#list").append("<p>"+ museums[m].distance_citycentre )
//+ $("#list").append('<img src="/images/' + museums[m].images + ‘/>’”)
}
A function is run when a museum is selected.
function loadKelvin() {
$("#content").append('<img src="/CourseworkResources/images/' + museums[0].images + '"/>');}
They are to be displayed in a div called "content". However the return is simply nothing or: [object Object][object Object][object Object]
PHP file
<?php
$museumsarray = array(
array("museum_id" => "1", "museum_name" => "Kelvingrove Art Gallery and Museum", "museum_description" => "Glasgow's main art gallery and museum situated in the west end of the city.", "museum_type" => "Art Gallery",
"address" => "Argyle Street", "postcode" => "G3 8AG", "lat" => "55.8684124", "long" => "-4.29054489999998", "website" => "http://www.glasgowlife.org.uk/museums/kelvingrove/Pages/default.aspx",
"distance_citycentre" => array("driving_miles"=>"2.2", "driving_minutes"=>"12", "walking_miles"=>"1.7", "walking_minutes"=>"34"),
"opening_hours" => array("Monday"=>"10am-5pm","Tuesday"=>"10am-5pm","Wednesday"=>"10am-5pm","Thursday"=>"10am-5pm","Friday"=>"11am-5pm","Saturday"=>"10am-5pm","Sunday"=>"11am-5pm"),
"closed_days" => array("January 1st", "January 2nd", "December 24th", "December 25th", "December 26th", "December 31st"),
"images" => array(
array("image_id" => "34", "description" => "Front View Of Kelvingrove", "url" => "Kelvingrove_Front_View_1 (Medium).jpg"),
array("image_id" => "35", "description" => "Front View Of Kelvingrove", "url" => "Kelvingrove_Front_View_2 (Medium).jpg"),
array("image_id" => "36", "description" => "Front View Of Kelvingrove", "url" => "Kelvingrove_Front_View_3 (Medium).jpg"),
array("image_id" => "37", "description" => "Front View Of Kelvingrove", "url" => "Kelvingrove_Front_View_4 (Medium).jpg"),
array("image_id" => "38", "description" => "Rear View Of Kelvingrove", "url" => "Kelvingrove_Rear_View_1 (Medium).jpg"),
array("image_id" => "39", "description" => "Rear View Of Kelvingrove", "url" => "Kelvingrove_Rear_View_2 (Medium).jpg"),
array("image_id" => "40", "description" => "Organ in Kelvingrove Art Gallery", "url" => "Organ_Kelvingrove (Medium).jpg"),
array("image_id" => "41", "description" => "Heads Exhibit at Kelvingrove", "url" => "Heads_Kelvingrove (Medium).jpg"),
array("image_id" => "42", "description" => "Exhibits at Kelvingrove", "url" => "Plane_Elephant_Giraffe (Medium).jpg")
),
"keyterms" => array(1,2,4,8,12,13,16,23,26,27,29,30,31,32,33,34,36,39,40,41,43,46,49,50)
),
Function
function loadKelvin(){
$("#content").append("<p>" + "<h4>"+"Museum Name "+"</h4>" +museums[0].museum_name)
$("#content").append("<p>" + "<h4>"+"Description "+"</h4>" +museums[0].museum_description)
$("#content").append("<p>" + "<h4>"+"Address "+"</h4>" +museums[0].address)
$("#content").append("<p>" + "<h4>"+"Postcode "+"</h4>" + museums[0].postcode)
$("#content").append("<p>" + "<h4>"+"Type "+"</h4>" +museums[0].museum_type)
$("#content").append("<p>" + "<h4>"+"Website "+"</h4>"+ "<a href>" + museums[0].website+ "</a>")
$("#content").append("<p>" + "<h4>"+"Opening Hours "+"</h4>" + museums[0].opening_hours)
$("#content").append("<p>" + "<h4>"+"Closed Days "+"</h4>" + museums[0].closed_days)
$("#content").append("<p>" + "<h4>"+"Distance from City Centre "+"</h4>" + museums[0].distance_citycentre)
}