Home >Backend Development >PHP Tutorial >javascript - What do you need to do on the server when learning AJaX?

javascript - What do you need to do on the server when learning AJaX?

WBOY
WBOYOriginal
2016-10-19 10:40:481003browse

I teach myself how to make web pages and want to use ajAx technology.
Doesn’t his technology require the browser to request information from the server, then the server responds and returns the information, and then the browser processes the information?
I am local (the computer where I study), how should I operate without a server?

If I have a server, what should I write on the server to receive requests from the browser? returned messages? Is it using javascript language? Or do you need to use Node.js and PHP to operate the server?

I hope someone can give me some knowledge. Thank you in advance.

Reply content:

I teach myself how to make web pages and want to use ajAx technology.
Doesn’t his technology require the browser to request information from the server, then the server responds and returns the information, and then the browser processes the information?
I am local (the computer where I study), what should I do without a server?

If I have a server, what should I write on the server to receive requests from the browser? returned messages? Is it using javascript language? Or do you need to use Node.js and PHP to operate the server?

I hope someone can give me some knowledge. Thank you in advance.

  1. Debugging of ajAx must require the server side

  2. But the so-called server side is not necessarily a real server, but just an http service that can provide data return. You can build it locally (you can use node.js to build it locally)

  3. Ajax server data is not essentially different from ordinary http services (the only difference is actually the data content (format) - defined by your program)

  4. All ajax requests are actually ordinary http requests. You can even build a fully static http service to support ajax program debugging. Of course, if you want to debug a very complex ajax program, the server generally needs to be able to handle some dynamic transfers. information coming.

  5. However, generally ajax programs are actually developed jointly between the client and the server

The browser sends an ajax request-->The server receives the browser's request-->The server processes the data-->Returns the data to the browser-->The browser processes
https://cnodejs.org/api /v1/topics This is an interface provided by other websites

Every computer can be regarded as a server.

For Nodejs, you can try the Express application generator to quickly create an application skeleton

Generally speaking, when it comes to simply learning AJAX, you don’t need to configure your own server. There are many cross-domain APIs available on the Internet.

Just create an integrated environment wampserver locally

Recommend you a simple and easy-to-use API PHP framework www.phalapi.net
You can quickly get started with back-end interface writing

Submit the front-end information to the server through ajax. After receiving the information, the server returns response data to the client, and then the client receives the response data from the server and processes it. At this time, you can understand that ajax is an http server, used to provide the front end with the ability to initiate interactions with the server. The server usually needs a back-end language to write the API and expose the API to the front-end for use.

You request the server address, and then the server just returns the data for you to parse.

I have also just started self-study, and currently use wampserver to build a local server, with PHP and Apache servers.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn