Hi Pals
Im getting Object Expected Error and Im new to Ajax . I have pasted the Html code here .. please help .
the data file is in the same folder as the html file is and just contains some basic text
do reply to[edit]
Im getting Object Expected Error and Im new to Ajax . I have pasted the Html code here .. please help .
Code:
<html>
<head>
<title>My first ajax Application </title>
<script language="javascript">
var XMLHttpRequestObject =false;
if(window.XMLHttpRequest)
{
XMLHttpRequestObject = new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}
funtion getdata(datasource , divid)
{
if (XMLHttpRequestObject)
{
var obj = document.getElementById(divid);
XMLHttpRequestObject.open("GET",datasource);
XMLHttpRequestObject.onreadystatechange = funcion()
{
if (XMLHttpRequestObject.readystate ==4 && XMLHttpRequestObject.status ==200)
{
obj.innerHTML = XMLHttpRequestObject.responseText;
}
}
XMLHttpRequestObject.send(null);
}
}
</script>
</head>
<body>
<form>
<input type ="button" value="Click here " onclick="getdata('data.txt','target')">
</form>
<div id = "target">
Hi this is just a test
</div>
</html>
do reply to[edit]
Comment