Hi guys, Can you give me better links than google for XML Parsing with AJAX? I am googling but can not find any good examples for it. My friend will make XML files with Delphi and than i will parse them with AJAX and publish on my website.
Ajax is a misnomer. It stands for "Asynchronous Javascript with XML", but it doesn't HAVE to be xml files that you do. Ajax is all about the asynchronous part, meaning that it executes WITHOUT reloading the page. If he's giving you the pages in XML that's great and it makes it a bit easier depending on if you know how to use xml pages, but learning about the ajax part really has nothing to do with xml and everything to do with making asynchronous javascript calls through an XMLHTTP object.... which object depends on which browser your client is using.
I bought a book for this(Professional Ajax, Wrox). Writers described it very easily. But it needs so many lines of coding
Okay well here is basically what you need to do. <script type="text/javascript"> function createRequestObject() { var ro; var browser = navigator.appName; if(browser == "Microsoft Internet Explorer"){ ro = new ActiveXObject("Microsoft.XMLHTTP"); }else{ ro = new XMLHttpRequest(); } return ro; } var http = createRequestObject(); function sndReq() { http.open('get', 'yourfile.php?r='+Math.random()); http.onreadystatechange = handleResponse; http.send(null); } function handleResponse() { if(http.readyState == 4){ var response = http.responseXML.documentElement; //PARSING alert(response.getElementsByTagName("tagnamegoeshere")["index of tag name"].childNodes["Index of child"].firstChild.data); } } </script> Code (markup):