Ajax Loader 2 | JavaScriptSource

Ajax Loader 2

Eddie Traversa Aug 31, 2005


Use this script to load XML and HTML files with XMLHTTPREQUEST. In the div id=EchoTopic tag, just add the name of the file to load and the element to display the file in, usually a div element.


  • Created by: Eddie Traversa

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: ajaxLoader.js


Paste this code into your external CSS file or in the <style> section within the HEAD section of your HTML document.


Paste this code into the BODY section of your HTML document

Leave a Response


function ajaxLoader(url,id) { if (document.getElementById) { var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest(); } if (x) { x.onreadystatechange = function() { if (x.readyState == 4 && x.status == 200) { el = document.getElementById(id); el[removed] = x.responseText; } } x.open("GET", url, true); x.send(null); } }

log out Nov 22, 2013


kalvin Jan 10, 2013

its very nice to understand and implement it... thanks..

thamil Sep 8, 2008

I love AJAX!

phannarak Aug 10, 2008

Nice content. thanks

fnfzone Jun 25, 2008