Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Mar 2006
    Thanked 0 Times in 0 Posts

    Internet Explorer - 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).

    This is the AJAX part of the code on my JSP page:

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

    var req;

    function ajaxtest(treenodeid){

    //req = null;

    if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
    else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");

    if (req.readyState != 0) {

    clickedNodeID = treenodeid;

    var url = "webdeskAjax.faces?clickedNodeID="+ treenodeid;

    // send request to the server
    if (req != null) {
    req.open("GET", url, true);
    req.onreadystatechange = processAjaxTreeResponse;


    function processAjaxTreeResponse() {
    if (req.readyState == 4){
    //process only if OK
    if (req.status == 200) {
    if(req.responseText==null) {
    else {



    function parseAjaxResponse(result){

    var divnode = document.getElementById(clickedNodeID + ":divid");

    divnode.innerHTML = result;




    The variables req and clickedNodeID contain the XMLHTTPRequest object respevtively the ID of the node which has been lastly


    The parseAjaxResponse 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,


  • #2
    Regular Coder
    Join Date
    Aug 2005
    Thanked 0 Times in 0 Posts
    does the alert fire?
    does it have content?

    also, the test for req.abort() should be done before you attempt to reset that req to another instance of XMLHTTP
    Last edited by KC-Luck; 03-06-2006 at 07:27 PM.


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts