Jump to Navigation

ajax

017 - Ajax text return sample code

JavaScript generate an instance of a XMLHTTPRequest object and it can make a server request for text.

Example:

http = new XMLHttpRequest();

function getServerText() {
var myurl = 'textserver.php';
http.open("GET", url, true);
http.onreadystatechange = useHttpResponse;
http.send(null);
}

JavaScript:

015 - XMLHTTPRequest for all browsers

You need to create a script that will correctly create an instance of XMLHTTPRequest object regardress of which browser you are using . A good solution to this problem is to have your script try in turn each method of creating an instance of object, until one such method succeeds.

Example:

function getXMLHTTPRequest()

var request = faulse;

try{ request = new XMLHttpRequest();  /* e.g. Firefox */ }

catch(err1)

JavaScript:
Subscribe to RSS - ajax


Main menu 2

by Dr. Radut