This time I will bring you a detailed explanation of the steps to read the page using jQuery ajax's get() function. What are the precautions for using jQuery ajax's get() function to read the page? The following is a practical case, let’s take a look.
First introduce the get() function:url,[data],[callback],[type]
url: URL address of the page to be loaded
data: Key/value parameter to be sent.
callback:
Callback function when loading is successful. type: Return content format, xml, html, script, json, text, _default.
First create the testGet.php instance:
<?php $web = $_GET['webname']; echo "你现在访问的网站是:".$web; ?>
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title> PHP </title> <script type="text/javascript" src="./jquery-1.7.1.min.js"></script> <script> $(document).ready(function(){ $("#btn").click(function(){ $.get("testGet.php",{web:"www.phpddt.com"},function(data,textStatus){ $("#result").append("data:"+data); $("#result").append("<br>textStatus:"+textStatus); }); }); }); </script> </head> <body> <input type="button" value="测试" id="btn" /> <h2>显示的内容如下:</h2> <p id="result"></p> </body> </html>
Summary of jquery ajax form submission method
The above is the detailed content of Detailed explanation of the steps to read the page using jQuery+ajax using the get() function. For more information, please follow other related articles on the PHP Chinese website!