PDA

View Full Version : javascript - getElementsByTagname Problem


ragtek
12-13-2007, 08:45 PM
hi
i have a form which comes with an ajax response and looks like this:
<?xml version="1.0" encoding="windows-1252"?>

<template><![CDATA[<form><input type="text" name="bildname"><input type="submit">]]></template>

<bildid>3906</bildid>

now the js code for checking looks like this:
showform:function(ajax){

var error = ajax.responseXML.getElementsByTagName("error")[0];
if (error){
alert(ajax.responseXML.getElementsByTagName("error")[0].firstChild.nodeValue);
}
else {
var bildid = ajax.responseXML.getElementsByTagName("bildid")[0].firstChild.nodeValue;
fetch_object("formcontainer_"+bildid).innerHTML =ajax.responseXML.getElementsByTagName("template")[0].firstChild.nodeValue;
}
}
i'm getting this error: ajax.responseXML.getElementsByTagName("bildid")[0] has no properties
[Break on this error] var bildid = ajax.responseXML.getElementsByTagName("bildid")[0].firstChild.no... but as you see, it is in the response

--------------- Added 1197645091 at 1197645091 ---------------

nobody a idee?:(

ragtek
12-15-2007, 09:31 AM
problem solved
i hadn't a group in the xml file so the file was "wrong"