AJAX Intro

AJAX Request Build

AJAX Examples

External Ajax File Example Demo

Ajax code you can implement into external js file same as JavaScript. and after linked with the web page.

Following example is external Ajax implemented code are linked with main web page. You can use that external file in multiple web page.

Example Code

function external_ajax(){
    var xhr = null;
    try {
        xhr = new ActiveXObject('Msxml2.XMLHTTP');
    catch (e) {
        try {
            xhr = new ActiveXObject('Microsoft.XMLHTTP');
        catch (e) {
    		try {
    			xhr = new XMLHttpRequest();
    		} catch (e) {
    			xhr = false;
    return xhr;

Example Code

    <script src="ajax.js" type="text/javascript"></script>
<script type="text/javascript">
	var xhr = external_ajax();
	document.write("Return Response for External File:  " + 
    "<br />" +
    "Your browser support " + xhr + " object");

Run it...   »

Example Result