javascript - Google Books API JSON object trouble -


i trying pull google books api , insert titles first 10 results web page. have site pulling correct request , have following callback function handling results

function insert(books) {     var list = books.items;     var i;     for(i = 0; < 10; i++){         var title = list[i].title;     var tag = "result" + i;     var x = document.getelementbyid(tag);     x.innerhtml = title;     } } 

for ease lets suppose following call made

<script src="https://www.googleapis.com/books/v1/volumes?q=way of kings&filter=partial&callback=insert"></script> 

right inserts word "undefined" in every place should insert title. can't find error here.

the response data has title placed in volumeinfo object.

replace:

var title = list[i].title; 

with:

var title = list[i].volumeinfo.title; 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -