Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- function insertrecord() {
- var xhttp = new XMLHttpRequest();
- xhttp.onreadystatechange = function() {
- if (this.readyState == 4 && this.status == 200) {
- retrieverecord();
- }
- };
- var userid = document.getElementById("txtuid").value;
- var username = document.getElementById("txtusername").value;
- var password = document.getElementById("txtpassword").value;
- //var page = "insertdata.php?uid=jacky&name=Jacky Boy&pass=lol";
- var page = "insertdata.php?uid="+ userid +"&name=" + username +"&pass=" + password;
- xhttp.open("GET", page, true);
- xhttp.send();
- }
- function retrieverecord() {
- var xhttp = new XMLHttpRequest();
- xhttp.onreadystatechange = function() {
- if (this.readyState == 4 && this.status == 200) {
- document.getElementById("demo").innerHTML = this.responseText;
- }
- };
- var page = "retrievedata.php";
- xhttp.open("GET", page, true);
- xhttp.send();
- }
- </script>
- <!DOCTYPE html>
- <html>
- <body>
- <input placeholder="Enter User Id" type="text" id="txtuid" value="" /><br>
- <input placeholder="Enter User Name" type="text" id="txtusername" value="" /><br>
- <input placeholder="Enter User Password" type="text" id="txtpassword" value="" /><br>
- <input type="button" value="Insert Record" onclick="insertrecord()" />
- <input type="button" value="Show Records" onclick="retrieverecord()" />
- <div id="demo"> </div>
- </body>
- </html>
Add Comment
Please, Sign In to add comment