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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:14:15+00:00 2026-06-03T01:14:15+00:00

So I am using a jQuery .load() call to implement endless pagination in a

  • 0

So I am using a jQuery .load() call to implement endless pagination in a CakePHP web app.

Here is the Javascript code:

$("#post_container").append('<div class="batch row" style="display:none;"></div>'); //append a container to hold ajax content
        var url = $("a#next").attr("href"); //extract the URL from the "next" link
        $(".paging").remove(); // remove the old pagination links because new ones will be loaded via ajax
        if(url === undefined)
        {
            $("#ajax_pagination_text").html("<strong>Turtles all the way down. No more posts :(</strong>");
        }

        $("div.batch").load(url, function(response, status, xhr) {
            if (status == "error") {
              var msg = "Sorry but there was an error: ";
              alert(msg + xhr.status + " " + xhr.statusText);
            }
            else {
                $(this).attr("class","loaded row"); //change the class name so it will not be confused with the next batch
                $(".paging").hide(); //hide the new paging links
                $(this).fadeIn();

            }
        });

The important part here is the $.load() which tries to load a url (http://www.MYWEBSITE.com/posts/index/page:2). When jQuery makes the request the server returns a 500 internal server error Same thing if I use jQuery.ajax(url);. If I go to that url directly it loads, no problem.

The ajax call works fine on my local development server as well. So this must be something with the setup on my host 1and1. What’s going on here? I’ve already had to deal with a few 500 server errors with this host.

I’ve changed my .htaccess files as follows to fix previous 500 errors:

.htaccess in CakePHP root:

<IfModule mod_rewrite.c>
   AddType x-mapp-php5 .php
   SetEnv PHP_VER

   RewriteEngine ON
   RewriteBase /
   RewriteRule    ^$ app/webroot/    [L]
   RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>

.htaccess in CakePHP app/:

<IfModule mod_rewrite.c>
   AddType x-mapp-php5 .php


    RewriteEngine ON
    RewriteBase /
    RewriteRule    ^$    webroot/    [L]
    RewriteRule    (.*) webroot/$1    [L]
 </IfModule>

.htaccess in CakePHP app/webroot/:

<IfModule mod_rewrite.c>
   AddType x-mapp-php5 .php
   AddHandler x-mapp-php5 .php

    RewriteEngine ON
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ /index.php?q=$1 [QSA,L]
</IfModule>

any help or insight is much appreciated!

  • 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-03T01:14:16+00:00Added an answer on June 3, 2026 at 1:14 am

    So it turns out this was a problem in the way I was changing which view was rendered by Cake depending on whether the call was AJAX or not.

    Originally I had this, to change the view that is rendered:

    if ($this->RequestHandler->isAjax()) {  
       $this->render('/posts/ajax_paging');  // Special view for ajax pagination
    }
    

    Which worked flawlessly on my local development server. But once uploaded this was having problems. The server said it couldn’t find the view.

    Changing it to the following fixed the issue:

    if ($this->RequestHandler->isAjax()) {  
      $this->render('ajax_paging');  // Render a special view for ajax pagination
    }
    

    I’m guessing it had to do with the fact that the actual folder “Posts” has a capitol P and my windows server is not case sensitive so “/posts” resolved to “/Posts” but once I put it on the linux servers at 1and1 the case became an issue.. Also after reading the CakePHP documentation I realized I didn’t even need the directory since the view was from the same controller. Hence the resulting code.

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

Sidebar

Related Questions

I am using jQuery .load to call an action but it is not found.
I am using jQuery to call web service (*.asmx) methods. The web service uses
When loading a html page using JQuery load, I also need to call another
I'm trying to load an external document using jQuery, $.load call. It seems to
I am puzzled, I have a call with jQuery using .load to fill a
I'm currently using jquery's ajax feature or whatever they call it. To load data
I need to load a part of code dinamically by using Jquery and Json.
So I'm trying to load a javascript remotely using jquery's $.getScript, but I'm puzzled
When using jQuery.load to dynamically load HTML content into a webpage, what is the
I am using jquery load method to update divs , it works great until

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.