Not signed in (Sign In)

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.


    • CommentAuthorjustnajm
    • CommentTimeNov 16th 2006
     
    Hi all,

    Have heard about ajax but don't have much knowledge about it.

    Ajax is a mixture of xml and javascript.

    Ajax can perform some validations as it also uses javascript. I have learned xml and xml does'nt provide high level handling of logical situations.

    Ajax can increase the performance of web pages as it provide the capability of loading specific objects not the whole page as user view the page again or refresh it for updated information, ajax will load only the update information.

    /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" />

    Please share your knowledge as many of the web businesses go through such problems of performance and validations.
    • CommentAuthorjustnajm
    • CommentTimeDec 28th 2006
     
    Information will load without refreshing the page
    Simple example:


    <html>
    <head>
    <title>Simple Ajax Example</title>
    <script language="Javascript">
    function xmlhttpPost(strURL) {
        var xmlHttpReq = false;
        var self = this;
        // Mozilla/Safari
        if (window.XMLHttpRequest) {
            self.xmlHttpReq = new XMLHttpRequest();
        }
        // IE
        else if (window.ActiveXObject) {
            self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
        }
        self.xmlHttpReq.open('POST', strURL, true);
        self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        self.xmlHttpReq.onreadystatechange = function() {
            if (self.xmlHttpReq.readyState == 4) {
                updatepage(self.xmlHttpReq.responseText);
            }
        }
        self.xmlHttpReq.send(getquerystring());
    }

    function getquerystring() {
        var form     = document.forms['f1'];
        qstr = "OK";
        return qstr;
    }

    function updatepage(str){
    document.getElementById("result").innerHTML = str;
    }
    </script>
    </head>

    <form name="f1">
      <p>Press the button to load the search contents from google on this page. Search Keywords used are: ajax tutorial  
      <input value="Go" type="button" onclick='java script:xmlhttpPost("http://www.google.com.pk/search?hl=en&q=ajax+tutorial&btnG=Google+Search&meta=")'></p>There is a space between onclick="java script" remove it
    <div id="result"></div>
    </form>
    </body>
    </html>
    • CommentAuthorjiosis
    • CommentTimeJan 30th 2007
     
    Thanks Justnajm for sharing your information about AJAX,
    I don't have much knowledge about it and haven't experienced it yet but interested in the first free time to start learning it.

    I found a very brief tutorial about it at:
    http://www.w3schools.com/ajax/ajax_intro.asp

    It will give you a good understanding to start if you are not familiar with it.

    Cheers