Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- var xmlhttp;
- window.onload = function() {
- document.addEventListener("deviceready", init, false);
- }
- function init() {
- var url = "http://foobar.com/index.php"
- xmlhttp = new XMLHttpRequest();
- xmlhttp.onreadystatechange = processResponse;
- xmlhttp.open("GET", url, true);
- xmlhttp.send();
- }
- function processResponse() {
- console.log(xmlhttp.readyState + " " + xmlhttp.status);
- if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
- document.getElementById('testdiv').innerHTML = xmlhttp.responseText;
- } else {
- document.getElementById('testdiv').innerHTML = "<strong>Waiting...</strong>";
- }
- }
- </script>
- <body>
- <div id="testdiv"></div>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement