CodesJava

Easy learning with example program codes

Ajax http request example


Ajax refers to asynchronous java script and xml. It is not a not a programming language. Ajax is of Asynchronous type. It normally uses XML, plain text or JSON to communicate with server i.e. for data transfer.

Note: Ajax is technology independent.

As we discussed in previous tutorial that XMLHttpRequest object is used for communication between client and server.

The open() and send() methods of the XMLHttpRequest object are used to send a request to a server.

 

Method Description
open(method,url,async,user,psw) It specifies the request.
Where:
method: the request type GET or POST
url: the file location
async: true (asynchronous) or false (synchronous)
user: optional user name
psw: optional password
send() It sends the request to the server. It is used for GET requests
send(string) It sends the request to the server. It is used for POST requests

 

 

Example:

xhttp.open("GET", "test.txt", true);
xhttp.send();
Posted in Ajax   
Sign Up/ Sign In
Ask a Question


Industrial Training

We offers Placement Oriented Training on Java, Spring, JSF, Hibernate, PHP, AngularJS, Angular 4, PLSQL, Oracle BI Publisher etc. We also provides Online training, please mail us at hr@codesjava.com.

Development

We also provides the Development services for Website Development , Java Development, PHP Development, Android App Development etc. You can contact us on hr@codesjava.com.

Copyright © 2018 CodesJava DMCA.com Protection Status SiteMap Reference: Java Wiki