Simple Ajax hello world

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Hello Ajax World</title> <script type="text/javascript">   function createXHR() { try { return new XMLHttpRequest(); } catch(e) {} try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e) {} try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e) {} try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {} try { return new ActiveXObject("Microsoft.XMLHTTP"); } […]
Continue reading…

Enjoyed this post? Share it!

 
 

XMLHttpRequest object open method for connection handling

Syntax: open("method", "url" [, asyncFlag [, username [, password]]]) Properties: method The HTTP request method to be used to establish a connection with the web server (GET, POST). url The URL of the file/http resource to be opened on the web server. asyncFlag An optional value that when set to true (default) sets up an […]
Continue reading…

Enjoyed this post? Share it!

 
 

Instantiating a XMLHttpRequest Object in Ajax

The XMLHttpRequest object is instantiated as the first step in an ajax request. XMLHttpRequest object instantiation happens differently based on different browsers. In FireFox, Safari, Opera, IE 7 or higher var Request = false; if (window.XMLHttpRequest) { //Try FireFox, Safari, Opera, IE 7 or higher Request = new XMLHttpRequest(); } The if statement executes the […]
Continue reading…

Enjoyed this post? Share it!

 
 

Ajax XMLHttpRequest Properties

The different XMLHttpRequest properties that can be queried while doing an Ajax request are mentioned below. readyState A value between 0 and 4 indicating the state of the receipt of data from the web server. 4 indicates that the data has been received. status A status code indicating the overall status of the XMLHttpRequest object’s […]
Continue reading…

Enjoyed this post? Share it!

 
 

Ajax XMLHttpRequest Methods

The XMLHttpRequest object in Javascript has two methods that enable client side scripts to connect to web servers and submitting requests. open() method– This method establishes a connection to a web server. send() method – This method sends a request to a web server. The open() method is used to initiate a connection to the […]
Continue reading…

Enjoyed this post? Share it!

 
 

Ajax Driven Google Live Search

Save the html page and php file below onto a web server. The example below shows how to send an ajax request to a php file and retrieve google search results as the user is typing in. page.html <HTML> <HEAD> <TITLE>An Ajax Driven Google Live Search</TITLE> <STYLE> #trgtDiv { background-color: #C0C0C0; width: 50%; border-style: solid […]
Continue reading…

Enjoyed this post? Share it!