This property is a textual of the status property, eg status equal to 404 then statusText will be the same as Not Found. Forms XMLHttpRequest Object-To create an XMLHttpRequest object you can use the following code. After you finish creating the XMLHttpRequest object you can send a request to the server. Bali Web Design - When sending a request to the server you must specify the request method used, whether to use GET or POST. If you want to display information from server then you will use GET method, while if you send information to server then use POST method. In this tutorial there will learn to use GET method (POST will be explained in the next tutorial). To send a request to the server using the GET method, you can use the code below.
Function above takes the parameter element HTML ID and the URL of the file on the server. The first thing to do is to replace the innerHTML property of the HTML element, to display the text "loading ... please wait". Then open the connection to the server with the open () method. If the readyState property is equal to 4 (complete) and the status is equal to 200 (OK) then show response from the server by replacing the innerHTML property of the HTML element with the responseText property of the XMLHttpRequest object.