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 = 'aaaa'; 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!