Home > Backend Development > PHP Problem > How to get php data in html5

How to get php data in html5

Release: 2023-02-28 07:54:01
Original
5728 people have browsed it

How to get php data in html5

HTML5 method of obtaining php data:

HTML code

<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0-rc1.js"></script>
</head>
<body>
<script type="text/javascript">
    $(document).ready(function(){
        $.ajax({
            url:"sms.php",
            type: "GET",
            dataType: "text",
            success: function(data){
                alert(data);//$a的值
            }
 
        })
    })
   
</script>
</body>
</html>
Copy after login

sms.php :

<?php
$a = &#39;aaaa&#39;;
echo $a;
?>
Copy after login

Recommended: php server

The above is the detailed content of How to get php data in html5. For more information, please follow other related articles on the PHP Chinese website!

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