Using AJAX for getting data on web pages without reloading them ?

We have to be a bit familiar with the Java script for the use of ajax.
In this example ,a java script function which is calling the post function using ajax.
<script type="type/javascript" >
function ajaxunload()
{
//here we created the obj of the xmlhttprequest , which is a mile stone to ajax .
//all latest browser like internet explorer 5 or abve uses activeXobject
//this object exchanges the data with the server ..
obj  = new XMLHttpRequest();
//It stores the function or the name of the function to be called automatically when the readystate //property changes 
 obj.onreadystatechange = function ()
 {

   if (obj.readyState == 4 && obj.status == 200)
{
// here we are storing the data which is returend from the ajax function.
  var s = obj.responseText
   obj.abort();
  }
 }

  obj.open("POST", "postfunction", true);
  obj.send();
}
</script>

Comments

Popular posts from this blog

How to use lamda expression for updating using LINQ

using session for login and logout in asp.net

How to post data in MVC using form collection for Beginners.