javascript - Ajax jquery load method cannot read information in php

WBOY
Release: 2016-08-04 09:19:11
Original
1162 people have browsed it

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>
Copy after login
Copy after login

This is the php code

<code><?php
    echo "dsjaflkasdj";
?>
</code>
Copy after login
Copy after login

I want to ask if it is a server problem and how to fix it

Reply content:

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>
Copy after login
Copy after login

This is the php code
<code><?php
    echo "dsjaflkasdj";
?>
</code>
Copy after login
Copy after login

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


Are you sure php is started?
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template