Hi i am new in Ajax.request() and i need your help to solve my problem. i have used four attributes of ajax.request i.e. onFailure onCreate, onException and onComplete.
My HTML page is:---
<html>
<head>
<style type="text/css">
body
{
background: #C0C0C0;
font-family:sans-serif;
font-size: 26pt;
}
ul.dev={list-style-type: circle;}
</style>
<title>The HTML</title>
<script type="text/javascript" src="jquery-1.2.2.js"></script>
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="thejs.js"></script>
<script type="text/javascript">
function testdata()
{
var temp;
var xmlhttp;
alert("First FUnction");
new Ajax.Request("/xml/ab.xml",
{
onFailure:function()
{
alert("2nd function");
},
onCreate:function()
{
document.write("3rd function");
},
onException:function(req,exception)
{
alert("Exception Occured" + " " + exception);
},
onComplete:function(xhr)
{
temp.innberHTML = xhr.responseText;
alert("run");
}
});
}
function state_Change()
{
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)
{
// if "OK"
if (xmlhttp.status==200)
{
//alert("Response"+xmlhttp.responseText);
temp.innerHTML = xmlhttp.responseText;
document.write(temp);
}
else
{
alert("Problem retrieving XML data");
}
}
}
</script>
</head>
<body>
<form>
<table>
<tr>
<th>Top <b>3</b> Developers of country</th>
<td>
<ul class="dev">
<li>Rahul Urane</li>
<li>Lokesh Paunikar</li>
<li> Saurab Soni</li>
</ul>
</td>
</tr>
<tr>
<td><input type="submit" id="submit" name="submit" value="submit" onclick="testdata()" /></td>
<td><input type="submit" id="getData" name="getData" value="Get Data!" onclick="abc()" /></td>
</tr>
</table>
</form>
</body>
</html>
on runing this HTML page in Browser i am getting my first alert and onCreate attribute is also runing well, but after onCreate excution of Ajax.Request() excution goes on onException instead of onComplete and raise the following exception.
My Exception is:---
Exception Occured [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.open]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame ::
http://192.168.1.101:8080/tp-ls-formcontroller-example-0.0.1/html/prototype.js :: anonymous :: line 1215" data: no]
please help me to resolve this problem as soon as possible.
Thankh you.