473,587 Members | 2,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript XMLHTTPRequest Problem

Hello everyone,

I'm currently trying to add some AJAX functionality to the tree2
JSF-component from the Apache MyFaces project (i. e. if the user clicks
on some node of the tree component, then not the whole tree is to be
rendered again but just the part of the tree which has actually
changed).

Using Mozilla as browser everything works fine, but if IE is used I'm
facing the following problem:

If I click on the [-] box next to an expanded node, nothing happens (of
course, normally the node should be closed) - however, there is a
single node being displayed by the component where it actually works
(it is always the same node, independant of the order in which this
node respectively the other ones are expanded and closed - very strange
behaviour...)
This is the AJAX part of the code on my JSP page:

<script type="text/javascript">
<!--
var clickedNodeID;

var req;

function ajaxtest(treeno deid){

//req = null;

if (window.XMLHttp Request) {
req = new XMLHttpRequest( );
}
else if (window.ActiveX Object) {
req = new ActiveXObject(" Microsoft.XMLHT TP");
}

if (req.readyState != 0) {
req.abort();
}
clickedNodeID = treenodeid;

var url = "webdeskAjax.fa ces?clickedNode ID="+ treenodeid;

// send request to the server
if (req != null) {
req.open("GET", url, true);
req.onreadystat echange = processAjaxTree Response;
req.send(null);
}

}

function processAjaxTree Response() {
if (req.readyState == 4){
//process only if OK
if (req.status == 200) {
if(req.response Text==null) {
hidePopup();
}
else {
parseAjaxRespon se(req.response Text);

}
}
}
}
function parseAjaxRespon se(result){
var divnode = document.getEle mentById(clicke dNodeID + ":divid");

divnode.innerHT ML = result;

alert(result);
}
//-->
</script>
The variables req and clickedNodeID contain the XMLHTTPRequest object
respevtively the ID of the node which has been lastly clicked.

The parseAjaxRespon se method determines a certain div element and adds
the content being sent from the server to this element.

The alert statement has been added merely for testing purposes (as my
MS-Debugger crashes every time I'm trying to move a single step
further- anyone in here made similar experiences with the
application???) : every time I click on the [-] box the content that is
added to the div element is equal to the content that has been saved in
the element before the user action. The point is, that the server has
not been contacted (I've registered a PhaseListener to my FacesContext)
so I absolutely do not know where the content comes from...

Anyone got any advice what could be the reason for that odd behavior??

Thanks a lot,

Alex

Mar 3 '06 #1
1 1506
mauroalberti wrote:
The point is, that the server has
not been contacted (I've registered a PhaseListener to my FacesContext)
so I absolutely do not know where the content comes from...


I had a similar problem with IE. It was caching responses from
XMLHttpRequests . Try making

var url = "webdeskAjax.fa ces?clickedNode ID="+ treenodeid;

into

var url = "webdeskAjax.fa ces?clickedNode ID=" + treenodeid +
"&requestid =" + (new Date()).getTime ();
Nige
Mar 4 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
8540
by: mikeyjudkins | last post by:
Ive been banging my head on the wall for hours with this one, hopefully someone will know what Im doing wrong here :\ The Goal: I have an xml file that is generated on the fly via JSP which I want to load into a Microsoft.XMLHTTP ActiveX object and manipulate via javascript on the client side. Data is retreived from the server at the request of the javascript without having to reload the page. The Problem:
4
2064
by: Guillaume CABANAC | last post by:
Hi everybody, Does anybody know how to access a remote database (say Oracle) from JavaScript code (within a Firefox Extension) ? I know ADO via ActiveX in the IE world and think a similar thing exists in Firefox. Thanks a lots,
7
10974
by: C.Joseph Drayton | last post by:
I have a problem that I am hoping someone can help me with. First let me describe the problem. I have an HTML form that in one field has an onBlur call to a JavaScript function. When you exit the field, it calls the JavaScript routine, which in turn calls a PHP script. The PHP script runs returns the value needed. And returns to the JavaScript. The JavaScript function is then supposed to set alerts depending on the values returned from...
10
4611
by: seanism | last post by:
Hello all I am new to javascript and I am attempting to write a site in JS / PHP to jump on the ajax band wagon. I am getting the following error and have not been able to locate a solution for it yet. From what I have read some people say it could have to do with xmlrequest being busy or something like that. Error: " nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: mysite :: getImage :: line 37" data: no]...
1
2180
by: 4levels | last post by:
Dear Folks, I stumbled upon a strange behaviour of the XMLHttpRequest.. Maybe I'm just not well informed enough about its possibilities, so could someone please confirm my question? When I put plain javscript in a file that is read-in through a XMLHttpRequest-object, it's like it is totally ignored. Eg. I have the file ajax_include.html with in it's body the following lines <script type="text/javascript" language="javascript">
7
5009
by: KaNos | last post by:
Hello aspx world, I consume a webservice with Javascript functions. But the response is ok and, very strange, document is null. How to resolve this problem thanks ?????? xmlHttpRequest.open("POST", myAddressLocation, false); xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xmlHttpRequest.send(xmldocumentSoapRequest);
1
7690
by: vocalise | last post by:
The title probably isn't very clear, but I haven't been able to find this problem (or I must be having problems figuring out which search strings to use) so I apologize if this has been addressed before, and I apologize if this is the wrong forum since I'm trying to use the XMLHTTPRequest with Javascript and PHP and I couldn't figure out which category my problem belonged to. I am completely new to AJAX and rusty with Javascript. I created a...
3
3456
by: SM | last post by:
Hello, Im trying to access elements in my XML file using the JavaScript DOM but i'm not sure how. I use AJAX to access the XML and then use the responseXML property to access the XML file data. I want to extract all the tracks from a specific CD. Right now, im using an array to stock all the data but its just a question of time before everything blows up because of the size of the array. Thats why im want to use an XML file (later i will...
20
4023
RMWChaos
by: RMWChaos | last post by:
Currently testing in: WinVista / IE7 I have been working on getting xmlhttprequest going for weeks now. I have finally gotten a semi-working script going. Pulling up text or xml files works great and populates into the webpage; however, executing javascript has a few problems: 1. Opens on a blank page, but not a new page. It appears to compeltely overwrite the original page. I want it to update the existing page by loading within a <div>...
0
7924
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7854
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8219
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7978
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
5722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3845
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2364
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.