PROWAREtech

articles » current » javascript » tutorial » page-22

JavaScript: Tutorial - A Guide to JavaScript - Page 22

AJAX, XML, Comet.

Ajax and Comet

AJAX

AJAX is covered here.

XML

XML is not fully supported by browsers like JSON is.

var x = new XML("<Vehicles>" +
	"<Vehicle>" +
		"<Maker>Honda</Maker>" +
		"<Model>Ridgeline</Model>" +
	"</Vehicle>" +
	"<Vehicle>" +
		"<Maker>Subaru</Maker>" +
		"<Model>WRX</Model>" +
	"</Vehicle>" +
	"<Vehicle>" +
		"<Maker>Honda</Maker>" +
		"<Model>Element</Model>" +
	"</Vehicle>" +
	"<Vehicle>" +
		"<Maker>Porsche</Maker>" +
		"<Model>911</Model>" +
	"</Vehicle>" +
	"</Vehicles>");

In the above example, assuming the browser supports it, x would be an object and have properties like x.Vehicles.Vehicle[0].Maker.

Comet

Comet is an advanced AJAX technique also referred to as server push. With Comet, the server pushes data to the page instead of the page requesting data from the server like in AJAX.

The page initiates a request to the server and the server holds that connection open until it has data to send. Once the data is sent, the connection is closed by the browser and a new connection is immediately opened up to the server. This continues for as long as the page is open.

<<<[Page 22 of 22]>>>

This site uses cookies. Cookies are simple text files stored on the user's computer. They are used for adding features and security to this site. Read the privacy policy.
CLOSE