I wrote a beginner AJAX tutorial, you can view it here: http://webmaster-forums.code-head.com/showthread.php?p=3183#post3183 I hope it helps someone. Thanks!
Very nice tutorial..I Just learned AJAX basics in a few minutes..Thanks.. M Waiting for continuation..lol
You didn't learn AJAX (It's not a language). You learned how to use the built-in functionality of AJAX in the Yahoo library with deprecated HTML.
It's still an AJAX request. YUI normalizes the whole thing so your code covers a wide range of browsers and as long as you are using this great code library, you can think of more abstract high level solutions and let YUI deal with those little details. That is why vBulletin, cPanel and Paypal (many more giants) are now using YUI. Also this is one of the best practices in programming, reuse great code. http://en.wikipedia.org/wiki/Code_reuse
It's AJAX which stands for Asynchronous JavaScript and XML, here is a little quote from Wikipedia: http://en.wikipedia.org/wiki/Ajax_(programming) No where in AJAX description states that you have to write all the XMLHTTPRequest stuff yourself then it's *real* AJAX
well in that case all I have to do is write a function that makes an ajax request. so for you to "know" ajax all you have to do is write the name of the function. example: var xmlHttp; //Put it outside the function so it stays global function ajax() //Put the xmlhttp option in a function to reduce the code. { try // Firefox, Opera 8.0+, Safari { xmlHttp=new XMLHttpRequest(); } catch (e) // Internet Explorer { try { xmlHttp=new ActiveXObject("MSXML2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } } function ajaxr(url) { ajax(); xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4) alert(xmlHttp.responseText); } xmlHttp.open("GET",url,true); xmlHttp.send(null); } PHP: so all you have to do to "know" ajax is write?: ajaxr('path/to/somefile.html'); PHP: I disagree.
I'm well aware that AJAX is a technique, I'm writing more tutorials about how to use it, this one is just to get it started. Thanks for all the comments anyway... BTW your code is broken if you have to make multiple simultaneous requests.
I think his concern is being able to refer to this object elsewhere. As the code is, ajaxr('path/to/somefile.html'); results in an alert of the responseText. Of course, that doesn't help too much unless we want to output this to the user. What we really want to be able to do is store that and then parse through it to display/evaluate the necesary information. His question is, I think, how can we use this multiple times, once right after the other, and have two different XML files available for display?