HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <h1>JavaScript get Request</h1> <p>Click on the button to send a get Request.</p> <button onclick="myFunction()">Click Me</button> <script> function myFunction() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { alert(this.responseText); } }; xhttp.open("GET", "/greet-specific.php?myname=Alex", true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send(); } </script> </body> </html>
OUTPUT
×

Save as Private