تابع CALLBACK
بازگشت به صفحه اصلی
بازگشت به صفحه مقاله
دو ستونی
دو سطری
اجرای کد RUN »
<!DOCTYPE html> <html> <body> <h2>Request With a Callback Function</h2> <p>The PHP file returns a call to the function you send as a callback.</p> <button onclick="clickButton()">Click me!</button> <p id="demo"></p> <script> function clickButton() { var s = document.createElement("script"); s.src = "demo_jsonp2.php?callback=myDisplayFunction"; document.body.appendChild(s); } function myDisplayFunction(myObj) { document.getElementById("demo").innerHTML = myObj.name; } </script> </body> </html>