Ajax Simple Example
In previous chapter i explained browser compatibility for browser.
So now we will see a simple example for AJAX.
Code for Example 1 |
function hide() { var x =document.getElementById("hello"); x.innerHTML=""; } function ajax() { if(window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { var x= document.getElementById("hello"); x.innerHTML= "<h3>Hi Welcome to Ajax tutorial</h3><h2 style='color:red;'>Kamalakannan JS</h2>"; } xmlhttp.open("Post","http://ajaxtutorialonline.blogspot.com"); xmlhttp.send(); } |
Post a Comment