Results 1 to 3 of 3

Thread: loading a php file through javascript

  1. #1
    Join Date
    Oct 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default loading a php file through javascript

    Ok I'm using a dynamic php page that loads a graphic from mysql data..
    <img src="imageMeter.php">

    I call that in a javascript file that puts it to a div tag

    document.getElementById('element1').innerHTML = "<img src='imageMeter.php'>";

    So clicking a particular javscript link displays the given graph to the element1 div.

    My question is, is it possible, using a similar technique, that displays the output of a standard .php file?

    Example

    document.getElementById('element1').innerHTML = 'testpage.php'


    where testpage.php is
    <?php
    echo "test string";
    ?>

    Then clicking the link would put 'test string' into the element1 div tag...

  2. #2
    Join Date
    Jun 2006
    Posts
    182
    Thanks
    0
    Thanked 14 Times in 14 Posts

    Default

    AJAX perhaps?

  3. #3
    Join Date
    Oct 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yea I thought of that.

    I was trying to find away to so it similar to the <img> tag. I already have multiple ajax requests on the page so was trying to stay away from another one...

    Was just looking for ideas..

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
  •