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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:13:15+00:00 2026-06-02T19:13:15+00:00

My pjax doesn’t work, as I see time changes.. Can you find something wrong

  • 0

My pjax doesn’t work, as I see time changes..

Can you find something wrong with my code.

<html><head>
<script src="jquery.js"></script>
<script src="jquery.cookie.js"></script>
<script src="jquery.pjax.js"></script>
<script type="text/javascript">
$('a[data-pjax]').pjax()
</script>
</head><body>
<?php
$header = "this is first part
<br/> <a href='pjax2.php' data-pjax='main'>GO</a>";
$date = date("Y-m-d H:i:s");
$footer = "this is second part";
$headers = getallheaders();
if(($headers['X-PJAX'] == 'true')){
echo "<div id='main'>first change</div>";
}else{
echo "$header<br/>$date<br /><div id='main'>first page</div><br />$footer";
}
?>
</body></html>

Best,
MJ

  • 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-02T19:13:17+00:00Added an answer on June 2, 2026 at 7:13 pm

    Edit: The main problem is that you are trying to use a cutting-edge browser feature without having mastered basic debugging of a web-page.

    You resolved the error with getallheaders() in php, so this should be easy for you.

    Step 1: Load http://www.bluereservations.com/pjax.php, open the browser console, refresh the page and check for messages in the console.

    It reports an error that $ is not defined. That suggests jquery didn’t load successfully.

    Step 2: Load http://www.bluereservations.com/jquery.js

    One mystery solved.

    AFTER getting all the obvious problems with the page out of the way, then look at more obscure things. For pjax that will involve inspection of network resources, http request and response headers, etc.

    If you are using Firebug for Firefox then read http://getfirebug.com/wiki/index.php/Net_Panel for details.
    For pjax you will need to turn on the persist option in case pjax fails.

    The following might address the other issues with your test-pages…

    When responding to a X-PJAX request you only send the main content, not the whole page. For your test-case something like

    <?php $headers = getallheaders();
          if($headers['X-PJAX'] == 'true'): ?>
    first change
    <?php else: ?>
    <html>
    <head>
    <script src="jquery.js"></script>
    <script src="jquery.cookie.js"></script>
    <script src="jquery.pjax.js"></script>
    <script type="text/javascript">
    $(function() { $('a[data-pjax]').pjax(); });
    </script>
    </head>
    <body>
    <?php
      $header = "this is first part
        <br/> <a href='pjax2.php' data-pjax='main'>GO</a>";
      $date = date("Y-m-d H:i:s");
      $footer = "this is second part";
      echo "$header<br/>$date<br /><div id='main'>first page</div><br />$footer";
    ?>
    </body>
    </html>
    <?php endif; ?>
    

    jquery-pjax does allow you to send the whole file in response to X-PJAX requests. Look in the docs for the fragment option.

    Personally HTMLDecor is a much easier way to get free pushState support, but I’m biased.

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

Sidebar

Related Questions

I am using PJAX https://github.com/defunkt/jquery-pjax and I was wondering since the whole page does
I use Pjax with tutorial from http://railscasts.com/episodes/294-playing-with-pjax?view=comments I don't need change url and this
Hey so I am using Rails PJAX for my web application with twitter bootstrap
I was trying to get PJAX working with my PHP site, this is the
I have an MVC3 application that I am implementing pjax into . Everything is
I'd like to prevent PJAX clicking of a link unless an input box is
i'm using the jquery Pjax plugin from Chris Wanstrath, aka, Defunkt, demo'd here: http://pjax.heroku.com
symfony: http://www.symfony-project.org pjax: https://github.com/defunkt/jquery-pjax Hi all, I'm trying to use pjax in symfony in
hello im trying to make something like github treeslider im new to javascript.. but
I have form on my page that has the following code <form class=form> ...

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.