File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Help needed in using Ajax.request (prototype.js API) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Help needed in using Ajax.request (prototype.js API)" Watch "Help needed in using Ajax.request (prototype.js API)" New topic

Help needed in using Ajax.request (prototype.js API)

Chitresh Katarpawar

Joined: Feb 08, 2010
Posts: 2
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:---

<style type="text/css">
background: #C0C0C0;
font-size: 26pt;
}{list-style-type: circle;}

<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",
alert("2nd function");

document.write("3rd function");

alert("Exception Occured" + " " + exception);

temp.innberHTML = xhr.responseText;

function state_Change()
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)
// if "OK"
if (xmlhttp.status==200)
temp.innerHTML = xmlhttp.responseText;
alert("Problem retrieving XML data");



<th>Top <b>3</b> Developers of country</th>
<ul class="dev">
<li>Rahul Urane</li>
<li>Lokesh Paunikar</li>
<li> Saurab Soni</li>

<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>

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) []" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: :: anonymous :: line 1215" data: no]

please help me to resolve this problem as soon as possible.

Thankh you.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63873

Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.

[Asking smart questions] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63873

Use the Firebug plugin of Firefox to see what's going on with the Ajax request. That might give you more clues as to why it's failing.
I agree. Here's the link:
subject: Help needed in using Ajax.request (prototype.js API)
It's not a secret anymore!