Results 1 to 7 of 7

Thread: Ajax Tabs and PHP calls on external linked pages, how to?

  1. #1
    Join Date
    Aug 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Ajax Tabs and PHP calls on external linked pages, how to?

    1) Script Title:
    Ajax Tabs
    2) Script URL (on DD):
    http://www.dynamicdrive.com/dynamici...tent/index.htm
    3) Describe problem:
    I'm looking to implement this ajax star rating system into my website. This requires a <php include...> at the top of the file that I which to use it and another <php drawrating...> call wherever I want the ratings to appear. This works fine with standalone HTML but I cannot get this to work with ajax tabs.

    I've tried passing the JS and CSS files required through the rev attribute but still no luck. I'm not sure where the problem is, will PHP calls not get executed from externally called pages using ajax tabs?

    Thanks,
    Jay

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

    Default

    will PHP calls not get executed from externally called pages using ajax tabs
    No, they won't. PHP is parsed by the server before page is served to (loads in) the browser. Ajax only imports content from a page, not a page. To import a page, use an iframe or frame.
    - John
    ________________________

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

  3. #3
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Yes, PHP calls will get executed if the extention is .php(or whatever your PHP extension is)

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

    Default

    Quote Originally Posted by blm126
    Yes, PHP calls will get executed if the extention is .php(or whatever your PHP extension is)
    I wouldn't have thought that possible but, it worked in a trial I just completed. To be clear, the external file is the one that needs the PHP server extension.

    I was able to retrieve the current values of this page:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    </head>
    <body>
    <?php
        print "Remote: " . $_SERVER["REMOTE_ADDR"] . "<br>";
       print date("F d, Y H:i:s", time());
    ?>
    </body>
    </html>
    Which I called remote.php when used with Ajax Tabs, like so:

    Code:
    <ul id="maintab" class="shadetabs">
    <li class="selected"><a href="#default" rel="ajaxcontentarea">Intro</a></li>
    <li><a href="remote.php" rel="ajaxcontentarea">Bird</a></li>
    <li><a href="external2.htm" rel="ajaxcontentarea">Dog</a></li>
    <li><a href="external3.htm" rel="ajaxcontentarea">Cat</a></li>
    <li><a href="external4.htm" rel="ajaxcontentarea">Sea Otter</a></li>
    </ul>
    Slipped it right into the demo.
    - John
    ________________________

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

  5. #5
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    It all comes down to the way AJAX works. AJAX is client side, and therefore the server doesn't even know an AJAX request is happening. Thus, it treats an AJAX request like a normal page request.

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

    Default

    Quote Originally Posted by blm126
    Thus, it treats an AJAX request like a normal page request.
    Within limits, only in so far as the body of that page is concerned. At least that is the way Ajax Tabs works. By this I mean to say that data in the head of the Ajax requested page gets ignored one way or the other in the process, things like meta tags, linked style, scripts, etc.
    - John
    ________________________

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

  7. #7
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Quote Originally Posted by jscheuer1
    Within limits, only in so far as the body of that page is concerned. At least that is the way Ajax Tabs works. By this I mean to say that data in the head of the Ajax requested page gets ignored one way or the other in the process, things like meta tags, linked style, scripts, etc.
    Yes, but once again it is the difference between the server and the client. It is the client that ignores the meta tags and such, the server can send anything it likes.

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
  •