inotgo.com


Tool version compatibility problem
Through AJAX Asynchronous JavaScript And XML Achieve asynchronous refresh
Correct

Example 1 : Page for user name verification   
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   

Example 1 :

Page for user name verification

edit top fracture
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
Operation effect
<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>



Source code
1. Double click the selected word 2. Triple Click to select the entire row 3. CTRL+F Find 4. F8 Full screen editing , Click restore again
Rendering Rendering complete
effect
Example 2 :

Do not use AJAX Verify whether the account exists by refreshing the page

edit top fracture
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
Operation effect
<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>


Source code
1. Double click the selected word 2. Triple Click to select the entire row 3. CTRL+F Find 4. F8 Full screen editing , Click restore again
Rendering Rendering complete
effect
Example 3 :

use AJAX Verify whether the account exists through no refresh

edit top fracture
Operation effect
<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>


Source code
1. Double click the selected word 2. Triple Click to select the entire row 3. CTRL+F Find 4. F8 Full screen editing , Click restore again
Rendering Rendering complete
effect


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
up-bear

synchronous It means synchronization ,A synchronous JavaScript And XML It can be translated into asynchronous refresh ? The correct meaning should be synchronous implementation ” Refresh “, This refresh is not another refresh , That is, you don't need to refresh to achieve ” Refresh “.




2 One answer

bird
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
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
answer Or code please Fill in at least one , If you have a problem , Please ask again , Otherwise, the webmaster may not see




2020-12-29 Do any students know python Version jsp How to achieve it , Do you have any teaching materials to recommend
hhhzt

Do any students know python Version jsp How to achieve it , Do you have any teaching materials to recommend




1 One answer

wanglin
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
answer Or code please Fill in at least one , If you have a problem , Please ask again , Otherwise, the webmaster may not see




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
about Front end part -Ajax-Hello AJAX Your questions

Try to provide Screenshot code and Abnormal information , Help to analyze and solve problems . You can also enter this station QQ Group communication : 496725845
Ask questions and try to provide complete code , Environment description , The more conducive to the recurrence of the problem , The faster your question can be answered .
Have questions about the code in the tutorial , Please provide which step , Which line is in doubt , This makes it easy to quickly locate the problem , Improve the speed at which questions are answered
In the thousands of questions that already exist , A considerable proportion , Because of the use of and webmaster Different versions of the development environment Resulting in , For example jdk, eclpise, idea, mysql,tomcat Wait, the version of the software is inconsistent .
Please use the same version as the webmaster , You can save yourself a lot of learning time . The webmaster sorted out the software versions used in teaching , It's all here , Convenient for everyone to download : /k/helloworld/helloworld-version/1718.html

Upload screenshot