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

How to get php data in html5

尚
Original
2019-10-31 10:27:265819browse

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>

sms.php :

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

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!

Statement:
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