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 7535295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:16:18+00:00 2026-05-30T06:16:18+00:00

I have a php page that also has another php page inside it, this

  • 0

I have a php page that also has another php page inside it, this php page has a paginator, is it possible that every time i paginate it would only load the inside page not the whole page?

i tried to go around this by using AJAX as you can see to my first post but i encountered this problem where i need to fetch the letter and page that i sent to ajax and use it again for the pagination, so it would be like javascript sending its variable to php i tried this:

 <script>
    function pagereturn()
    {
        return getpage;
    }
 </script>
 <?php  
     $pageno = pagereturn();
     echo $pageno;
  ?>

    function passPaginationAndLetter(page)
    {
    if (page=="")
      {
      document.getElementById("retail_group").innerHTML="";
      return;
      } 
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
                    document.getElementById("retail_group").innerHTML=xmlhttp.responseText;
        }
      }
    getpage = page;
    xmlhttp.open("GET","otherpage.php? letter="+getletter+"&pageno="+page,true);
    xmlhttp.send();

    }

    var page = 1;
    $("#nextButton").click(function(){
        page = page+1;
        passPaginationAndLetter(page);
    });

but unfortunately i ended up with no result and broke my code. btw getpage is a variable i took from another function.

Thank you very much, i am still new at javascript thus i am asking you for help. 🙂

—pagination code at child.php—-
{

}
else
{
if ($pageno == 1) {
//echo " FIRST PREV ";
}
else
{
echo " <a href='{$_SERVER['PHP_SELF']}?pageno=1'>FIRST</a> ";
$prevpage = $pageno-1;
echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$prevpage'>PREV</a> ";
}   
echo " ( Page $pageno of $lastpage ) ";
if ($pageno == $lastpage)
{
//echo " NEXT LAST ";
}
else
{
$nextpage = $pageno+1;
echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$nextpage'>NEXT</a> ";
echo " <a href='{$_SERVER['PHP_SELF']}?pageno=$lastpage'>LAST</a> ";
}

—pagination code at parent.php—–

else
{
    echo '<a href = "#" onclick="passPaginationAndLetter("1"); return false;">FIRST</a>';
    $prevpage = $pageno-1;
    echo '<a href = "#" onclick="passPaginationAndLetter('.$prevpage.'); return false;">PREV</a>';
}   
echo " ( Page $pageno of $lastpage ) ";
if ($pageno == $lastpage)
    {

    }
    else
    {
        $nextpage = $pageno+1;                      
        echo '<a id = "nextButton" href = "#" onclick="passPaginationAndLetter('.$nextpage.'); return false;">NEXT</a>';
        echo '<a href = "#" onclick="passPaginationAndLetter('.$lastpage.'); return false;">LAST</a>';                                              
    }
  • 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-05-30T06:16:19+00:00Added an answer on May 30, 2026 at 6:16 am

    ok, try this:

    Let’s say you have your main page, the one who shows all the pagination, called main.php, also you have an other php file with all the functions called functions.php.

    I assume that you have a php function in functions.php that genrates a single page of your pagination (getAJAXpage($page) for example). This function generates a complete HTML page, something like this (REMEMBER this is just an example, could be implemented by 1000 different ways):

    <?php //functions.php file
    ...
    public function getAJAXpage($page){
        $page = $_REQUEST['page'];//im not pretty sure about this :S
        $elements = getElements($page);//this function returns the set of elements in your page
        echo '<table>';
        foreach($elements as $e){
            echo '<tr><td>'.$e.'</td></tr>';
        }
        echo '</table>';
    }
    ...
    ?>
    

    what you can do in your php page main.php (the one who shows all the pagination) something like this:

    function getAjaxPage(page){ //this is a javascript code in main.php file   
        $.ajax({
            type:'GET',
            dataType:'html',
            url:'the-url-for-your-getAJAXpage-function',
            success:function(data){
                $("#your-pagination-element").html(data);
            }
        });
    }
    

    I also assume that in your pagination page’s html in your main.php file you have at least a set of buttons (or icons) to direct the pagination (next, prev, first, last,…). So you can add this code to the above javascript.

    //more javascript in main.php
    var page = 1;
    $("#nextButton").click(function(){
        page = page+1;
        getAjaxPage(page);
    });
    

    and so with all the buttons.

    NOTE: in this answer I also assume that you use the JQuery libray, highly recomended for begginers in javascript.

    Hope I helped you. Good luck!

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

Sidebar

Related Questions

I have a PHP page that I run every minute through a CRON job.
I have a page that is accessed via a URL like this: http://power-coder.net/Test/something.php?id=3#Page1 I
I have a function that I use on index.php page and I would like
I have a php page. This has multiple images which looks like tabs. With
I have a php page that displays rows from a mysql db as a
I have a PHP page that returns a piece of HTML to set the
I have a PHP page that does a couple of different things depending on
I have a php page that takes in a bunch of url parameters and
I have a PHP page that queries a DB to populate a form for
I have a particular PHP page that, for various reasons, needs to save ~200

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.