I know I’m just missing something stupid here. Anyone see what I’m doing wrong?
HTML:
<div id="pageheader">
<h1></h1>
<div></div>
</div>
Javascript/jQuery:
var si = [{
"courseid": "1",
"coursename": "MISY431/432",
"coursedescription": "Project Management and MIS Projects",
"sectionid": "1",
"sectionname": "",
"semesterid": "1",
"semestername": "Fall 2011",
"semesterstarttimestamp": "9/1/2011 12:00:00 AM",
"phaseid": "3",
"phasename": "Open to Students",
"phasedescription": "Students may view accepted projects and submit project team requests"}];
$("#pageheader h1").html(si.semestername + " " + si.coursename + " " + si.sectionname);
$("#pageheader div").html("Current Phase: <strong>" + si.phasename + "</strong> <em>" + si.phasedescription + "</em>");
console.log(si);
Renders as:
undefined undefined undefined
Current Phase: undefined undefined
Thanks,
– Greg
You have defined
sias an array, but are not indexing into that array when you are accessing the variable.Remove the square brackets around the definition of
siand you should be good to go.