Results 1 to 2 of 2

Thread: help with simple script

  1. #1
    Join Date
    Sep 2007
    Posts
    58
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default help with simple script

    <script>
    var tId=""; // create global variable to hold the interval handler
    function pollDB() {
    /* call the server and when return, call the javascript function showResult with the result */
    ajaxed.callback('poll', showResult);

    }
    function showResult(result) {
    $('res').innerHTML = result; // put the result into the div with id="res"
    }
    // onLoad (or set the same in the page load asp thingy )
    window.onload=function() { tId=setInterval('pollDB()',6000);
    }

    </script>

    <div id="res"></div>

    this script show the value it gets from other function and subs...but this is not the question
    i just want it to be shown inside of javascript alert(browser alert, with ok button)...
    how can i do this?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,496
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Code:
    var tId=""; // create global variable to hold the interval handler 
    function pollDB() {
    /* call the server and when return, call the javascript function showResult with the result */ 
    ajaxed.callback('poll', showResult);
    
    } 
    function showResult(result) { 
    alert(result); // alert result
    } 
    // onLoad (or set the same in the page load asp thingy ) 
    window.onload=function() { tId=setInterval('pollDB()',6000); 
    }
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •