I received this JSON response:
{"data":[{"series":{"id":"15404","series_code":"TOS","publisher_id":"280","series_short_name":"Tales of Suspense","start_year":"1959","end_year":"1968","published":"1959-1968","type_id":"1","no_issues":"99","published_gcd":"January 1959-March 1968","series_long_name":"Tales of Suspense (Marvel 1959-1968)","volume":"1","first_issue":"1","last_issue":"99","comment":"","created_date":"2013-03-24 01:00:00","user_id":"1","last_updated":"2013-03-24 01:00:00","note":"","is_active":"1","wiki_stem":null}}],"error":"boo"}
Here is the AJAX request:
$.ajax({
type: 'get',
url: '/series/lookup?year='+json.IssueYear+'&title='+json.Title,
beforeSend: function(xhr) {xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
},
success: function(response) {
if (response.error) {
alert(response.error);
console.log(response.error);
}
else {
//console.log(response.content);
alert(response.data[0].series.id);
}
},
error: function(e) {
alert("An error occurred: " + e.responseText.message);
console.log(e);
}
});
I expected to get the id value, but instead it shows an error that data is undefined?
alert(response.data[0].series.id)
It seems like I might be overlooking something, any assistance would be greatly appreciated.