Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-02-2008, 10:22 PM   PM User | #1
otnj2ee
Regular Coder

 
Join Date: Apr 2007
Posts: 174
Thanks: 17
Thanked 0 Times in 0 Posts
otnj2ee is an unknown quantity at this point
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
otnj2ee is offline   Reply With Quote
Old 04-02-2008, 11:30 PM   PM User | #2
mjlorbet
Regular Coder

 
mjlorbet's Avatar
 
Join Date: Jan 2008
Location: Milwaukee, WI
Posts: 724
Thanks: 8
Thanked 96 Times in 95 Posts
mjlorbet will become famous soon enough
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
mjlorbet is offline   Reply With Quote
Old 04-03-2008, 02:02 AM   PM User | #3
otnj2ee
Regular Coder

 
Join Date: Apr 2007
Posts: 174
Thanks: 17
Thanked 0 Times in 0 Posts
otnj2ee is an unknown quantity at this point
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
otnj2ee is offline   Reply With Quote
Old 04-03-2008, 09:39 PM   PM User | #4
mjlorbet
Regular Coder

 
mjlorbet's Avatar
 
Join Date: Jan 2008
Location: Milwaukee, WI
Posts: 724
Thanks: 8
Thanked 96 Times in 95 Posts
mjlorbet will become famous soon enough
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
mjlorbet is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:13 PM.


Advertisement
Log in to turn off these ads.