This article implements the Demo of the back-end Api of the Web request. The implementation is to realize the back-end request through JQuery's AJAX, and analyze and process the requested data to realize the login function.
Description of Requirement:
- Request backend Api interface address
- Judging and processing the jump of the front-end interface according to the returned information, and realizing login
Start implementing:
First of all, on the index.html page, there are two input boxes, user name and password, and a login button. Click the login button to compare the input login information with the one in the backend Api interface. If the verification is successful, jump to the main.html page , and display the logged in username
-
Realize the login interface, and use the bootstrap framework to quickly realize the prototype of the login interface
-
Apply for a backend Api interface: https://j.tewx.cn
1) Register and log in
2) Apply for 10,000 free accesses to the Api interface, enter in the key: loginInfo value: {"name":"zhangwei", "psd":"123"}
3) Get the Api interface address
- Put the api address in js and make a request
Observe the returned data
analyze, process
Realize logical judgment jump or prompt
- Final effect
Password error
login successful
- Source address:
https://j.tewx.cn/get/web.zip
If you have any questions, please leave a message and ask me~