Jump to content

aarontan78

Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Posts posted by aarontan78

  1. I have found the below code and modify a bit..somehow, it didn display the updated records.

    Can someone knows what the problem with below coding?

     

    connect.inc is the database connection and the page itself is saved as 'test.php'

    Thanks.

     

    <html>

    <head>

    <script type="text/javascript">

    function createRequestObject() {

      var ro;

      var browser = navigator.appName;

      if(browser == 'Microsoft Internet Explorer') {

        ro = new ActiveXObject("Microsoft.XMLHTTP");

      } else {

        ro = new XMLHttpRequest();

      }

      return ro;

    }

    var http = createRequestObject();

     

    function sndReq(action) {

      http.open('get', 'test.php');

     

      http.onreadystatechange = handleResponse;

      http.send(null);

    }

     

    function handleResponse() {

      if(http.readyState == 4) {

        var response = http.responseText;

       

          document.getElementById('foo').innerHTML = response;

      }

    }

    setInterval('sndReq()', 1);

    </script>

    </head>

    <body>

     

    <div id="foo">

    <?php

    include("inc/connect.inc");

    $q1 = "SELECT EVENT_DESC FROM EVENTS";

     

    $r1 = mysql_query($q1);

     

    $EVENT_DESC = mysql_result($r1,0,0);

     

    echo $EVENT_DESC;

    ?>

    </div>

    </body>

    </html>

  2. Hi all AJAX gurus

     

    Althought there are a lot of tutorials on retrieving data using ajax, I cant find any tutorial on how to display UPDATED records AUTOMATICALLY from mysql without having user to do onclick.  Can someone enlighten me?

     

    Thanks :)

  3. Hi all,

    I'm new to javascript.
    Is it possible to move the mouse cursor to a button in a webpage automatically when I open the page?
    Can I use the mouse right click to execute a javascript function?
    How can I do these?

    Thanks and regards.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.