The actual AJAX stands for Asynchronous Javascript and XML. Asynchronous means that you can interact with the server in asynchronous manner. Which means you don’t have to pause the browser, the browser don’t have to wait for the data have to return before preceding what happens is browser ask for data and data sent back to the browser, and when browser notified, continue in the meantime waiting for data continue processing and performing actions for the user. But when the data downloaded browser notified and the data is used by javascript inside the browser. That’s the javascript part of
So Asynchronous Javascript and XML, now there’s actually two ways working with data from the browser either plain text or XML. We’re going to work with plain text originally, because it’s easier to work with text and Javascript than XML. But you can also work with XML, XML plays crucial role on the web for data handling. It is the preferred technique for passing data backend and forth on the internet because XML data is in pure text form, and Internet World Wide Web set up to handle text sent back and forth in HTML format, you can send in XML format. So data being sent around in internet using XML, and going to work with XML a little bit. However text data being downloaded from internet.
the example Index.html, This is our first Ajax example shows us how to work with
XMLHttpRquest Object are what makes
var XMLHttpRequestObject = false;
Idea is now we have to create an XMLHttpRequest Object in order to proceed the rest of the
if (window.XMLHttpRequest)
This is the way we are checking, we’re working with non-microsoft browsers and if the window object supports XMLHttpRequest object creation. If so, this expression returns true. Then you can create XMLHttpRequst object like this
Set the variable
XMLHttpRequestObject = new XMLHttpRequest( );
if (window.ActiveXObject)
So this expression returns true then you have working in Microsoft Objects allow you to create XMLHttpRequest Objects. Then this is the way we do it, you set the XMLHttpRequestObject variable which was originally set to false. So new ActiveXObject(“Microsoft.XMLHttp”) ;
XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
That is the way the Javascript statement we need in Microsoft browsers in order to create a new XMLHttpRequestObject which you need for
Creates XMLHttpRequestObject set to false.
XMLHttpRequestObject = new XMLHttpRequest( );
So after this script executed, you have XMLHttpRequest object, which is focus of all
Examine this JavaScript code here :
var XMLHttpRequestObject = false;
if (window.XMLHttpRequest) {
XMLHttpRequestObject = new XMLHttpRequest();
} else if (window.ActiveXObject) {
XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
}
0 comments:
Post a Comment