Sponsered Links
Categories
Sponsered Links

Ajax Display Server IP Address

 

In the given example below we will see how to display server IP address dynamically with the help of AJAX, HTML, & PHP.

simpleAjax.html

<html>
    <body>
        <script type="text/javascript" >
            function ajaxfunction(){
                var xmlhttp;
                if(window.XMLHttpRequest){
                    xmlhttp=new XMLHttpRequest();
                } else {
                    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
                xmlhttp.onreadystatechange=function(){
                    if(xmlhttp.readyState==4){
                        document.timeform.time.value=xmlhttp.responseText;
                    }
                }
                xmlhttp.open("GET","simpleajax.php",true);
                xmlhttp.send(null);
            }
        </script>

        <form name="timeform" >
            Name:<input type="text" name="Name" onkeyup="ajaxfunction()"; /><br/>
            Time:<input type="text" name="time"/>
        </form>
    </body>
</html>

 

simpleAjax.php

<?php
    echo ($SERVER_ADDR);
?>

 
 
Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2009 JSPSERVLETTUTORIAL.INFO All Right Reserved