Pagination with get parameters
By default, all parameters in CakePHP are named parameters (url fragments like /foo:bar/). This also applies, by default, to pagination arguments.
To use get arguments for pagination params - you can do that by setting appropriate config:
public $paginate = array( 'paramType' => 'querystring' );
This will generate urls of the form:
/the/url?page=1&limit=10
Instead of:
/the/url/page:1/limit:10
Specifying urls as string is extremely fragile
Previously you mentioned using urls like get_backend_requests in javascript.
You will still find problems if you do that even using get arguments of pagination. That's because even for the "same" url, the result can be different:
/the/url => /the/get_backend_requests /the/url/ => /the/url/get_backend_requests
Instead - specify urls in javascript as absolute urls:
$.ajax({ type: 'POST', url: "/xyz/get_backend_requests", ...
If you're app is sometimes (or always) installed in a subfolder, you can account for that with a simple function:
e.g. in your html/layout put:
<html> ... <script> function url(url) { return <?php $base = rtrim(Router::url('/'), '/'); if ($base) { echo "'$base' + "; } ?>url; } </script>
Which will output:
<html> ... <script> function url(url) { return '/subfolder' + url; } </script> $.ajax({ type: 'POST', url: url("/xyz/get_backend_requests"), // becomes the string "/subfolder/xyz/get_backend_requests" ...