<h1> Hello World </h1> <h2> Welcome to the lidihuo.com </h2>
Example2.html
<!DOCTYPE html> <html> <head> <script src="/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ jQuery.ajax({ url: 'test.html', type: 'GET', success: function(data) { $("#para").html(data); } }); }); }); </script> </head> <body> <h3> This is an example of using the jQuery's ajax() method. </h3> <h4> Click the following button to see the effect. </h4> <button> Click me </button> <p id = "para"></p> </body> </html>
输出
This is an example of using the jQuery's ajax() method.
<h1> Hello World </h1> <h2> Welcome to the lidihuo.com </h2>
Example2.html
<!DOCTYPE html> <html> <head> <script src="/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ jQuery.ajax({ url: 'test.html', type: 'GET', async: false, success: function(res) { $("#para").html(res); } }); }); }); </script> </head> <body> <h3> This is an example of using the jQuery's ajax() method. </h3> <h4> Click the following button to see the effect. </h4> <button> Click me </button> <p id = "para"></p> </body> </html>
输出
This is an example of using the jQuery's ajax() method.
alert("Welcome to the lidihuo.com \n This alert is load by the AJAX");
Example2.html
<!DOCTYPE html> <html> <head> <script src="/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $.ajax({url: "test.js", dataType: "script"}); }); }); </script> </head> <body> <h3> This is an example of using the jQuery's ajax() method. </h3> <h4> Click the following button to see the effect. </h4> <button> Click me </button> <p id = "para"></p> </body> </html>
输出
This is an example of using the jQuery's ajax() method.