Saturday 9 February 2013

JavaScript and AJAX

JavaScript is an object oriented language but most of us does not know how this language works or how is uses the concept of object oriented language


In JavaScript you first create an object, there is no concept of class, then you can augment your own object or create new objects from it. JavaScript has a concept of prototype. The prototype property allows you to add properties and methods to an object.

This article contains all that is important to understand JavaScript and prototype.


How Ajax works :
With AJAX [Asynchronous JavaScript and XML], your JavaScript communicates directly with the server, through the JavaScript XMLHttpRequest object.

Different browsers use different methods to create the XMLHttpRequest object. Internet Explorer uses an ActiveXObject, while other browsers use the built-in JavaScript object called XMLHttpRequest.

Then, you'll follow the same basic outline in almost all of your Ajax applications:

  •     Get whatever data you need from the Web form.
  •     Build the URL to connect to.
  •     Open a connection to the server.
  •     Set up a function for the server to run when it's done.
  •     Send the request.

No comments:

Post a Comment