so for any of my programming people out there, i have a question about an assignment i’m working on-
i’m supposed to be using YQL to query google books & display title, subtitle & description information. these are my professor’s specific instructions:
Now create a Web page that will use YQL to query Google Books based on the query parameters. The user must be able to enter the query parameters named q, maxResults.
You will need to parse the output and display the following elements. I would like these elements put into a table. You can decide how to format the table. There will be several elements named <items>. Each element named <items> has the following children (among others). You must display all of the items not just the first item.
Title
Subtitle
Description
i have the input for q (the search term(s)) and the number of results set, but i can’t seem to get any of the book information to display in my table & i’m 90% sure it’s not in how my insertrow/insertcell statements are set up bc they worked fine on another assignment so i can only assume that i’m not finding the elements in need properly. this is essentially what my code looks like:
// The base URL for yql.
var yql_base_uri = "http://query.yahooapis.com/v1/public/yql?q=";
var searchterm;
searchterm = document.getElementById(”search”);
searchterm = search.value;
var maxresults;
maxresults = document.getElementById(”max”);
maxresults = max.value;
yql_query = "SELECT * FROM google.books WHERE q=‘” + searchterm + "’ AND maxResults=" + maxresults + “&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys”
var req = new XMLHttpRequest();
req.onreadystatechange = function () {
var docXML = req.responseXML;
var nodeList;
nodeList = docXML.getElementsByTagName("items");
var volumeinfo;
volumeinfo = nodeList[4];
var title = volumeinfo[0].childNodes[0].nodeValue;
var subtitle = volumeinfo[1].childNodes[0].nodeValue;
var desc = volumeinfo[5].childNodes[0].nodeValue;
the rest of it is my code for appending the values/info into the table rows. so...can anyone help me out here? if needed, i can upload the code to fiddle or something later when i go back to this. thanks in advanced!