Difference between revisions of "AJAX"
(New page: AJAX (Asynchronous JavaScript and XML) == Hello World == Einfaches AJAX Sample für Java Server Pages. * [http://www.claude-glauser.ch/j2ee/ajax/index.html index.jsp] * [http://www.claud...) |
|||
Line 7: | Line 7: | ||
* [http://www.claude-glauser.ch/j2ee/ajax/response.html response.jsp] | * [http://www.claude-glauser.ch/j2ee/ajax/response.html response.jsp] | ||
* [http://www.claude-glauser.ch/j2ee/ajax/AJAXWebApp.war AJAXWebApp.war] | * [http://www.claude-glauser.ch/j2ee/ajax/AJAXWebApp.war AJAXWebApp.war] | ||
+ | |||
+ | == Parsen eines XML Dokuments == | ||
+ | |||
+ | txt="<table>"; | ||
+ | x=xmlhttp.responseXML.documentElement.getElementsByTagName("book"); | ||
+ | for (i=0;i<x.length;i++) | ||
+ | { | ||
+ | txt=txt + "<tr>"; | ||
+ | xx=x[i].getElementsByTagName("title"); | ||
+ | { | ||
+ | try | ||
+ | { | ||
+ | txt=txt + "<td>" + xx[0].firstChild.nodeValue + "</td>"; | ||
+ | } | ||
+ | catch (er) | ||
+ | { | ||
+ | txt=txt + "<td> </td>"; | ||
+ | } | ||
+ | } | ||
+ | xx=x[i].getElementsByTagName("author"); | ||
+ | { | ||
+ | try | ||
+ | { | ||
+ | txt=txt + "<td>" + xx[0].firstChild.nodeValue + "</td>"; | ||
+ | } | ||
+ | catch (er) | ||
+ | { | ||
+ | txt=txt + "<td> </td>"; | ||
+ | } | ||
+ | } | ||
+ | txt=txt + "</tr>"; | ||
+ | } | ||
+ | txt=txt + "</table>"; | ||
+ | document.getElementById('copy').innerHTML=txt; |
Revision as of 23:21, 8 May 2008
AJAX (Asynchronous JavaScript and XML)
Hello World
Einfaches AJAX Sample für Java Server Pages.
Parsen eines XML Dokuments
txt="
"; x=xmlhttp.responseXML.documentElement.getElementsByTagName("book"); for (i=0;i<x.length;i++) { txt=txt + ""; xx=x[i].getElementsByTagName("title"); { try { txt=txt + "";} catch (er) {txt=txt + "";
} } xx=x[i].getElementsByTagName("author"); { try {txt=txt + "";
} catch (er) {txt=txt + "";
} }txt=txt + ""; } txt=txt + "
" + xx[0].firstChild.nodeValue + " | " + xx[0].firstChild.nodeValue + " |
";
document.getElementById('copy').innerHTML=txt;