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
    Regular Coder
    Join Date
    Apr 2007
    Posts
    179
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Relationship between the javascript and the AJAX

    I have a question about the relationship between the javascript and the AJAX. Let me take the IE for example. Before I can make the AJAX call, I'll initiate:

    var x = new ActiveXObject("Microsoft.XMLHTTP");

    My understanding of the process is like this: It is the javascript (API) to make the function call to the ActiveX API, i.e., the javascript merely initiates the function call and passes the needed parameters. The actuall processing/execution lies in the ActiveX API. The ActiveX API is the true AJAX engine.

    Is this interpretation correct?



    Thanks


    Scott

  • #2
    Regular Coder mjlorbet's Avatar
    Join Date
    Jan 2008
    Location
    Milwaukee, WI
    Posts
    724
    Thanks
    8
    Thanked 96 Times in 95 Posts
    no, ajax is asynchronous javascript and xml. the xhr object as it is called or xmlhttprequest for those who would spell it out. is the main player. while it is true that the xhr object must be instantiated through activex in ie6 and previous, opera, safari, mozilla and ie7+ use XMLHttpRequest() to instantiate instances of the xhr object, thus giving it full in language support. and while this "foreign" object is doing work for you, the manipulations on it are what is key, since all of these are done through javascript and measures have been taken to integrate it more fully with the language itself. the xhr object may be considered to be part of javascript (or at least an extension api almost). also note that the instantiation of the xhr object through the activex api will be deprecated (and soon) as far as web side things go, so referring to an activex control as the ajax engine may be true (for a very small portion of the current web browsers) for now, in the bigger scope of things, considering ajax in this fashion will only be detrimental
    -Mike
    "Want me to precludify him, like some kind of dispatcherator?... Can do!" -Bender

  • #3
    Regular Coder
    Join Date
    Apr 2007
    Posts
    179
    Thanks
    17
    Thanked 0 Times in 0 Posts
    I could be wrong, but to my knowledge, the javascript is synchronous in nature. Then how can:"ajax is asynchronous javascript" as you mentioned? --Can you elaborate it?

    (I thought it is the API of a browser(IE or Firefox alike), which does the asynchronous call to the web server. But as I said I could be wrong on this matter. If so, please don't hesitate to educate me on this).


    Thanks

    Scott

  • #4
    Regular Coder mjlorbet's Avatar
    Join Date
    Jan 2008
    Location
    Milwaukee, WI
    Posts
    724
    Thanks
    8
    Thanked 96 Times in 95 Posts
    javascript as linear code is synchronous, as any linear code is. the javascript/dhtml (or dom) eventing model made javascript asynchronous a long long time ago (because what we do as input is not synchronous). the only difference here is that a thread is being spawned & behaving in the same way as a thread is created in the parent operating system of the browser with an event hook for the onreadystatechange. yes, you are more correct in that the ajax request is an api of a browser, but it wouldn't be ajax without javascript driving the request & handling the response, also since the "api" is standardized, it doesn't make sense to believe it to be a browser or platform specific api. so here's the difference i think you're getting hung up on, the XHR is committed by the browser but ajax is the practice and implementation of employing the xhr to perform specific tasks.
    -Mike
    "Want me to precludify him, like some kind of dispatcherator?... Can do!" -Bender


  •  

    Posting Permissions

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