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 ..
//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();
{
// 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
Post a Comment