(i) Several methods and properties of the XMLHttpRequest object
Open () creates a new request to the server
Send () sends a request to the server
ReadyState provides current HTTP ready status
Status Server Response state code
Request response text returned by the ResponseText server
ReadyState
0: The request was not issued (before calling open ())
1: The request has been established but has not been issued (before send () is called)
2: The request has been sent out in process (the contents can usually be obtained from the response head)
3: The request has been processed, there are usually some data available in the response, but the server has not completed the response
(ii) Issues to be noted when using XML files for transmission
1. Use post transfer for XML files because the XML file can be very long and the get mode restricts the length of the data transfer
2. Tell the server to send an XML file
3. Send () by sending () and not appended to the last parameter of the URL
(iii) data transfer using JSON
Represents a method name/value pair and an array.
{"Employees": [{"FirstName": "Chen", "LastName": "Li"},{"firstName": "Wang", "LastName": "Xiao"}]}
Creating a JavaScript Object
var company={{"Employees": [{"FirstName": "Chen", "LastName": "Li"},{"firstName": "Wang", "LastName": "Xiao"}]};
Remove first element information
var firstname=company.employees[0].firstname
Modify the first element information
Company.employees[0].firstname= "Ceh"
4: The response is complete, you can access the server response and use it