Tool version compatibility problem
Through AJAX
Asynchronous
JavaScript
And
XML Achieve asynchronous refresh
Correct
Example 2 : Do not use AJAX Verify whether the account exists by refreshing the page Example 3 : use AJAX Verify whether the account exists through no refresh
Prepare one
JSP page , be called
checkName.jsp Used to verify whether the submitted user name exists
If the submitted user name is abc Print exists , Otherwise you can use Tips : use F5 Go back to the original page
<html> <a href="/study/checkName.jsp?name=abc">checkName.jsp?name=abc</a> <br> <a href="/study/checkName.jsp?name=def">checkName.jsp?name=def</a> </html>
<html> <a href="/study/checkName.jsp?name=abc">checkName.jsp?name=abc</a> <br> <a href="/study/checkName.jsp?name=def">checkName.jsp?name=def</a> </html>
If not AJAX, Traditional methods need to submit data
Refresh page To know if the user name exists .
Tips : use F5 Go back to the original page
<form action="/study/checkName.jsp"> Enter account number <input name="name" type="text" value="abc"> <input type="submit" value=" Verify whether the account exists "> </form>
<form action="/study/checkName.jsp"> Enter account number <input name="name" type="text" value="abc"> <input type="submit" value=" Verify whether the account exists "> </form>
<span> Enter account number :</span> <input id="name" name="name" onkeyup="check()" type="text"> <span id="checkResult"></span> <script> var xmlhttp; function check(){ var name = document.getElementById("name").value; var url = "/study/checkName.jsp?name="+name; xmlhttp =new XMLHttpRequest(); xmlhttp.onreadystatechange=checkResult; // response function xmlhttp.open("GET",url,true); // Set the page to visit xmlhttp.send(null); // Perform access } function checkResult(){ if (xmlhttp.readyState==4 && xmlhttp.status==200) document.getElementById('checkResult').innerHTML=xmlhttp.responseText; } </script>
The official account of programming , Follow and get the latest tutorials and promotions in real time , thank you .
![]()
Q & A area
2021-04-23
The translation is strange
2 One answer
bird Jump to the problem location Answer time :2021-06-11
asynchronous Asynchronous means asynchronous synchronous It means synchronization Just one letter away The webmaster wrote here A synchronous JavaScript And XML To highlight the acronyms AJAX, You shouldn't asynchronous Separate as a synchronous
DDQ Jump to the problem location Answer time :2021-05-13
Synchronize : Browser access server request , Users can see the page refresh , Resend request , Wait until the request is complete , page refresh , New content appears , Users see new content , Proceed to the next step . asynchronous : Browser access server request , User normal operation , The browser back end makes a request . Wait until the request is complete , Page does not refresh , New content will also appear , Users see new content .
The answer has been submitted successfully , Auditing . Please
My answer Check the answer record at , thank you
2020-12-29
Do any students know python Version jsp How to achieve it , Do you have any teaching materials to recommend
1 One answer
wanglin Jump to the problem location Answer time :2021-02-10
jsp My full name is java servlet page The beginning is java What are you looking for python web My tutorial
The answer has been submitted successfully , Auditing . Please
My answer Check the answer record at , thank you
2020-10-28
name
2020-05-15
The beginner died on the spot
2019-11-25
I hope the webmaster can teach and share from the perspective of beginners
Too many questions , Page rendering is too slow , To speed up rendering , Only a few questions are displayed on this page at most . also 10 Previous questions , please Click to view
Please... Before asking questions land
The question has been submitted successfully , Auditing . Please
My question Check the question record at , thank you
|