I am using appserv to build a server. Is there something wrong with the server? You can use the load method to read .html files but not .php. Attached is the code:
<code><!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script src='http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js'></script> <script> $(function (){ $('#send').click(function() { $('#resText').load('demo.php'); }); }) </script> </head> <body> <button id="send">点我点我点我</button> <div id="resText"></div> </body> </html> </code>
<code><?php echo "dsjaflkasdj"; ?> </code>
Reply content:
<code><!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script src='http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js'></script> <script> $(function (){ $('#send').click(function() { $('#resText').load('demo.php'); }); }) </script> </head> <body> <button id="send">点我点我点我</button> <div id="resText"></div> </body> </html> </code>
<code><?php echo "dsjaflkasdj"; ?> </code>
I want to ask if it is a server problem and how to fix it
You can directly access demo.php on the server to see if there is any output
It may be that the path is wrong. Check the console to see if there is a 404 error