Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8123457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:11:30+00:00 2026-06-06T06:11:30+00:00

I want to know if there is a way to display an external php

  • 0

I want to know if there is a way to display an external php file after clicking on a link, and then display another external file right below(not INSTEAD of) it after a different link was clicked. Here is my code.

index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html>  
<head>
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-   1.2.6.pack.js"></script>  
<script type="text/javascript" src="core.js"></script>   
</head>  
<body>   
<div id="menu">  
<ul>  
<li id="home"><a href="#downloads">DOWNLOADS</a></li>  
<li id="tutorials"><a href="#errors">ERRORS</a></li>  
</ul>   
</div>  
<div id="content">    
</div>  
</body>  
</html>  

core.js

//On load page, init the timer which check if the there are anchor changes each 300 ms
$().ready(function(){
setInterval("checkAnchor()", 100);
});
var currentAnchor = null;
//Function which chek if there are anchor changes, if there are, sends the ajax    petition
function checkAnchor(){
//Check if it has changes
if(currentAnchor != document.location.hash){
    currentAnchor = document.location.hash;
    //if there is not anchor, the loads the default section
    if(!currentAnchor)
        query = "page=1";
    else
    {
        //Creates the  string callback. This converts the url URL/#main&id=2 in URL/?section=main&id=2
        var splits = currentAnchor.substring(1).split('&');
        //Get the section
        var page = splits[0];
        delete splits[0];
        //Create the params string
        var params = splits.join('&');
        var query = "page=" + page + params;
    }
    //Send the petition
    $("#loading").show();
    $.get("callbacks.php",query, function(data){
        $("#content").html(data);
        $("#loading").hide();
    });
}
}

downloads.php

<b>DOWNLOADS</b>

errors.php

<b>ERRORS</b>

callbacks.php

<?php  
//used to simulate more waiting for load the content, remove on yor projects!  
sleep(1);  
//Captures the petition and load the suitable section  
switch($_GET['page']){  
case "errors": include 'errors.php'; break;
case "downloads": include 'downloads.php'; break;

default: include 'downloads.php'; break;

}  
?>

This works perfectly except it uses a switch and I want to be able to see both errors.php and downloads.php at the same time, not only one or the other.

EDIT

Pseudo code to make it clearer:

If download is clicked show download.php only. If error is clicked show error.php only(right after downloads.php) and don’t remove downloads.php or any other external file that may or may not be included on the main page already.

Any suggestions?

p.s. I’ve looked through many, many threads about this and that’s why I can’t post all the code I’ve tried (sorry I can’t include links either, last time my question was downvoted for doing that…>:/) so I can promise I’ve done my homework.

p.s.s. If you think this deserves a down vote please be kind enough to explain why. I’m open to criticism but just thumbs down is not helpful at all.

EDIT:

Updated core.js to

$(document).ready(function(){
$('#menu li a').click(function() {
    var currentAnchor = $(this).attr('href');
    if(!currentAnchor)
        var query = "page=1";
    else
    {
        var splits = currentAnchor.substring(1).split('&');
        //Get the section
        var page = splits[0];
        delete splits[0];
        //Create the params string
        var params = splits.join('&');
        var query = "page=" + page + params;
    }
    //Send the petition
    $("#loading").show();
    $.get("callbacks.php",query, function(data){
        $("#content").html(data);
        $("#loading").hide();
    });       
    return false;
});
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T06:11:31+00:00Added an answer on June 6, 2026 at 6:11 am

    EDIT:

    [The confusing parts removed here]

    —

    EDIT:

    core.js (revised)

    //On load page, init the timer which check if the there are anchor changes each 300 ms
    $(document).ready(function(){
        $('#menu li a').click(function() {
            var currentAnchor = $(this).attr('href');
            if(!currentAnchor)
                var query = "page=1";
            else
            {
                var splits = currentAnchor.substring(1).split('&');
                //Get the section
                var page = splits[0];
                delete splits[0];
                //Create the params string
                var params = splits.join('&');
                var query = "page=" + page + params;
            }
            //Send the petition
            $("#loading").show();
            $.get("callbacks.php",query, function(data){
                $("#content").html(data);
                $("#loading").hide();
            });       
            return false;
        });
    }​​​);​​​
    

    —

    EDIT:

    This one will “append” data [coming from either downloads or errors] to the existing content.

            $.get("callbacks.php",query, function(data){
                $("#content").append(data);
                $("#loading").hide();
            }); 
    

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to know is there any way that I can remove duplicates from
I want to know is there any way or message in MFC by which
I want to know if there is any way by which I can paste
I want to know if there is a better way (than what I'm currently
All I want to know is if there's an easy way to add lines
i want to know there a limitation in size for an iphone to display
I want to know if there is a simpler and quicker way to visualize
I want to know if there is any way for a offline build for
I want to know, is there a way that I can pass an object(let's
I know there is this post , but I still want to know more

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.