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

    AJAX timing issues

    Hello,

    I have 3 divs being populated with content onload via Ajax:

    Code:
    <body onload="prod_options('add','hide'); categories_pulldown(); disp_cats();">
    each of these functions uses the fairly standard xml httprequest call:

    http.open('get', 'page_name.php', true);
    http.onreadystatechange = handleResponse_options;
    http.send(null);

    The problem is, I have to space out these calls and time it just right, or else this content doesn't load and I get errors in my Javascript console:

    Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: https://mydomain.com/cms/store/inventory.js :: handleResponse_options :: line 61" data: no]
    Source File: https://mydomain.com/cms/store/inventory.js
    Line: 61
    Error: uncaught exception: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIXMLHttpRequest.send]" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: https://mydomain.com/cms/store/inventory.js :: disp_cats :: line 104" data: no]
    Wrapping these calls in a setTimeout works, but surely there must be a better way to do this? I've tried turning off async, but it seems like Firefox doesn't work with it off?

  • #2
    New to the CF scene
    Join Date
    Jul 2006
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Okay, setting the value of the async argument to "false" works just fine with Safari, but not with Firefox. So far, I haven't been able to reproduce this problem in Safari with teh async argument set accordingly. Of course, I'd very much like to get this working for Gecko too. If I figure this out, I'll post my solution.

  • #3
    New to the CF scene
    Join Date
    Jul 2006
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Looks like they are exploring this issue here:

    http://www.ajaxfreaks.com/forums/ind...st=0&#entry174

  • #4
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    I think you just need to look into OO JavaScript.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]


  •  

    Posting Permissions

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