I am currently following the example on pages 360-361 out of our book (Headfirst Ajax)
Here is the XML from the Ebay API that I am using :
Our blog would not let me post it but you can view the code by clicking
Here
I have following the expample out of the book to try and parse the XML using DOM
Here is the javascript code I have typed for the Ebay API
function displayDetailsEbay(){
if (Ebayrequest.readyState == 4) {
if (Ebayrequest.status == 200) {
//Add new item details
var responseDoc = Ebayrequest.responseText;
var PictureTable = document.createElement("table");
var TitleRow = document.createElement("tr");
var TitleData = document.createElement("td");
TitleData.appendChild(document.createTextNode("EBay Items"));
detailDiv.appendChild(TitleData);
targetDiv.appendChild(TitleRow);
var ItemPicture = responseDoc.getElementsByTagName("GalleryURL")[0];
var ItemPictureDetails = GalleryURL.firstChild.nodeValue;
var DataRow = document.createElement("tr");
var PictureInput = document.createElement("td");
PictureInput.appendChild(document.createTextNode(ItemPictureDetails));
detailDiv.appendChild(PictureInput);
var EbayTitle = responseDoc.getElementsByTagName("Title")[0];
var EbayTitleDetails = Title.firstChild.nodeValue;
var EbayTitleInput = document.createTextNode("td");
EbayTitleInput.appendChild(EbayTitleDetails);
detailDiv.appendChild(EbayTitleInput);
var EbayPrice = responseDoc.getElementByTagName("ConvertedCurrentPrice")[0];
var EbayPriceDetails = ConvertedCurrentPrice.firstChild.nodeValue;
var EbayPriceInput = document.createTextNode("td");
EbayPriceInput.appendChild(EbayPriceDetails);
detailDiv.appendChild(EbayPriceInput);
Please help...I can't get it to work
Apr 3, 2010
Subscribe to:
Post Comments (Atom)
You have quite a bit going on here Jeremy. Sorry I haven't responded to your email but I've been out of town. I will take a look at the code you sent me tomorrow and let you know if I come up with anything. However, I'm much better at the PHP than the Javascript so I don't know how much I can help you.
ReplyDeleteThank you!!
ReplyDeleteJeremy how is the progress of this going? If you found out any valuable information I would be very interested in listening to you what you have learned. I tried to do the ebay api for my group project and failed miserably.
ReplyDelete