I have a JSON array that has multidimensions to it:
{
"@id": "a",
"@label": "A",
"drecord": [
{
"@id": "aaliyah",
"@rdate": "2001-08-25",
"@lease": "bh05",
"name": {
"surname": "Aaliyah"
},
"job": "hip hop singer/actress",
"dead": {
"@value": "y"
},
"cause": "Burned to death in a plane crash",
"ddate": {
"date": "2001-08-25"
},
"bdate": {
"date": "1979-01-16"
},
"other": {
"#text": [
"Full name: Aaliyah Dana Haughton, was to have appeared in the second and third",
"movies."
],
"movie": "Matrix",
"home": {
"@id": "http://www.aaliyahEbertonline.com/"
},
"imdb": {
"@id": "Aaliyah"
},
"fg": {
"@id": "5727911"
}
}
},
and i am trying to use the jQuery Auto Complete to get the name and surname to populate...right now all its doing is returning blank results when i type in a name like "aaliyah".
here is my jQuery Code:
$( function() {
$( "#birds" ).autocomplete({
source: function( request, response ) {
$.ajax( {
url: "dpsportion.json",
type: "GET",
dataType: "json",
data: {
term: request.term
},
success: function( data ) {
response( data );
}
} );
},
minLength: 2,
select: function( event, ui ) {
console.log( "Selected: " + ui.item.drecord.name.fname + " aka " + ui.item.drecord.name.surname );
}
} );
} );
what am i doing wrong? I thought i had to reference the line that i want like drecord.name
or drecord.surname