Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <h1>The XMLHttpRequest Object</h1>
- <button type="button" onclick="loadDoc()">Request data</button>
- <p id="demo"></p>
- <script>
- function loadDoc() {
- var xhttp = new XMLHttpRequest();
- xhttp.onreadystatechange = function() {
- if (this.readyState == 4 && this.status == 200) {
- var respon = this.responseText;
- var data = JSON.parse(respon);
- // ambil data2 nya melalui variabel data
- // ...
- }
- };
- xhttp.open("POST", "file_php_tujuan.php", true);
- xhttp.send("username=myusername&password=89237j4tr2834yrdj2");
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement