Tuesday, September 20, 2011

CLEAR YOUR DOUBTS ABOUT AJAX XMLHttpRequestObject




Q: Am I supposed to understand all of this?

A: No, you’re not. For now, just try to get a general idea of how
all this looks and the way the pieces fit together. Focus on the big
picture, and then we’ll start to fill in the gaps in later chapters.


Q: So what’s an XMLHttpRequest?

A:XMLHttpRequest is what most browsers call the
request object that you can send to the server and get responses
from without reloading an entire page.

Q: Well, if that’s an XMLHttpRequest, what’s an
ActiveXObject?

A: An ActiveXObject is a Microsoft-specific
programming object. There are two different versions, and
different browsers support each. That’s why there are two
different code blocks, each trying to create a different version of
ActiveXObject.

Q: And the request object is called XMLHTTP in a Microsoft
browser?

A: That’s the type of the object, but you can call your variable
anything you’d like; we’ve been using request. Once you
have the createRequest() function working, you
never have to worry about these different types again. Just call
createRequest(), and then assign the returned value to
a variable.


Q: So my users don’t need to be using a specific browser?

A: Right. As long as their browsers have JavaScript enabled,
your users can be running any browser they want.

Q: What if they don’t have JavaScript enabled?

A: Unfortunately, Ajax applications require JavaScript to run.
So users who have JavaScript disabled aren’t going to be able
to use your Ajax applications.The good news is that JavaScript is
usually enabled by default, so anyone who has disabled JavaScript
probably knows what they’re doing, and could turn JavaScript
support back on if they wanted to use your Ajax app.


No comments:

Post a Comment