This article mainly introduces node. js + Ajax is used to obtain the data returned by the HTTP server. The explanation is very detailed and many examples are provided. It is a very good article. We recommend it to you here. Let's take a look at the sample code for retrieving HTTP server response data through AJAX requests on an HTML5 page. because we set the server port to 1337 and run the HTML5 page from the website with port 80, this is a cross-origin operation. We need to add the Access_Control_Allow_Origin field in the HTTP response header, specify the parameter as the domain name + port number that allows data requests from the server (when the port number is omitted, any port under the domain name is allowed to request data from the server ),
Static Page: index.html (Note: It must be placed in the server environment. If it is a Windows 7 system, you can enable the IIS service and run the page directly ,)
The Code is as follows:
Node ajax request (html5 page)