![]() |
AJAX Not Loading XML Value
I am still getting used to things like ajax and have a problem. I am creating a PBBG, a game made out of HTML, CSS, JS, ect. I have some code that will repace the content of some cells of the table with the values of some XML tags. It only is changing one box for now.
Basicly I want it to open the XML file, get "Archer" from the name tag, and place it in the th tag. But right now it only says "undefined". I figured out that that problem is with line 12 of my JS but I can't figure out how to fix it. Any help is apreiciated, thanks!I will leave a simplified vertion of the code here. (Simplifed being all the parts being used left.) XML Code:
<?xml version="1.0" encoding="ISO-8859-1"?>HTML Code:
<table>JS Code:
function Archer() |
I see some errors.
id naming error: First, you have "Name" with capital "N" in your th tag: Code:
<th id="Name" colspan="2">Code:
document.getElementById('name').innerHTML = txt;Fix your th tag and make the id lowercase: Code:
<th id="name" colspan="2">You aren't properly accessing your 'name' node, as you need an index value(like [0]), and also you aren't accessing the value in the child of that node by using nodeValue. Replace these lines: Code:
txt="";Code:
var txt = ""; |
| All times are GMT +1. The time now is 12:27 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.