defunkt / jquery-pjax

pushState + ajax = pjax
https://pjax.herokuapp.com
MIT License
16.73k stars 1.97k forks source link

Fetching URL described as Virtual Folder does not work #613

Closed tetrahydra closed 8 years ago

tetrahydra commented 8 years ago

I have an issue here.

I am using htaccess to map files.

RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?page=$1 [L,QSA,NC]

For example www.ebyx.net/about will be mapped to www.ebyx.net/index.php?page=about

On the localhost, I have no problem, but when put into server, it doesnt work.

Pjax request and after it got the content, it forced to reload the page.

But, when I changed the link and request without virtual folder, for example, real file is index_about.php pjax has no problem.

I wonder if the problem caused because the path has no file extension, or because pjax appended target div along with the URL.

tetrahydra commented 8 years ago

Problem solved.

Problem was because I tried to use $(this).attr('data-target') to get div-target in this format:

$(document).pjax('a[data-pjax]', $(this).attr('data-target'));

from

<a href="home" data-pjax data-target="#main_content" data-toggle="menu_navbar">Home</a>

replaced with

$(document).pjax('a[data-pjax]', '#main_content');

and now links work as they are intended to.