<!DOCTYPE html> <html> <body> <h1>请求调用函数</h1> <p>PHP 文件返回对您作为回调发送的函数的调用。</p> <button onclick="clickButton()">单击我!</button> <p id="demo"></p> <script> function clickButton() { var s = document.createElement("script"); s.src = "/static/demo/php/demo_php_jsonp_db.php?callback=myFunc"; document.body.appendChild(s); } function myDisplayFunction(myObj) { document.getElementById("demo").innerHTML = myObj.name; } </script> </body> </html>