Realize the Demo of the back-end Api of the Web request. The realization is to realize the back-end request through JQuery's AJAX, and analyze and process the requested data to realize the login function

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:
  1. Request backend Api interface address
  2. 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

  1. Realize the login interface, and use the bootstrap framework to quickly realize the prototype of the login interface
    insert image description here

  2. Apply for a backend Api interface: https://j.tewx.cn
    1) Register and log in
    insert image description here

2) Apply for 10,000 free accesses to the Api interface, enter in the key: loginInfo value: {"name":"zhangwei", "psd":"123"}
insert image description here

3) Get the Api interface address
insert image description here

  1. Put the api address in js and make a request
    insert image description here

Observe the returned data
insert image description here

analyze, process
insert image description here

Realize logical judgment jump or prompt

  1. Final effect
    Password error
    insert image description here

login successful

insert image description here

  1. Source address:
    https://j.tewx.cn/get/web.zip

If you have any questions, please leave a message and ask me~

Guess you like

Origin blog.csdn.net/qq_44444470/article/details/116016474