How can I show the data without reloading the page in HTML?
Started on: 11 July 13
Participants: 1
I don't wanna to reload the page and I want to show directly the Updating.... notification and I wanna reflect the result. Pls help me!
This challenge is listed under
Development & Implementations
Community
Related Posts:
Please login to reply this post
Important:
- We hope the conversations that take place on MyTechLogy.com will be constructive and thought-provoking.
- To ensure the quality of the discussion, our moderators may review/edit the comments for clarity and relevance.
- Comments that are promotional, mean-spirited, or off-topic may be deleted per the moderators' judgment.
2 Suggestions
instead of ajax_info.txt , use any other file like ajax_info.php or ajax_info.asp
Using ajax you can load the dynamic data from database using any language like PHP or Java
Try the below script
<!DOCTYPE html> <html> <head> <script> function loadXMLDoc() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); } </script> </head> <body> <div id="myDiv"><h2>Let AJAX change this text</h2></div> <button type="button" onclick="loadXMLDoc()">Change Content</button> </body> </html>