Reputation: 491
Im developing a CMS with PHP and MVC. I have the follow htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
So i have a dispatcher to go to diferents views depends of the permalink on the url.
My problem is that im trying to use ajax for a Login and few things more and cant make it works.
Is there any expception in .htaccess to make this work or i only can put more exceptions on dispatcher to load the .php in ajax?
Anyone can help me?
Thanks in advance.
EDIT:
$.post
(
"../ajax/login.php",
{
u:Base64.encode(user),
p:Base64.encode(password),
},
function(data)
{
},
"json"
);
I tried with:
"../ajax/login.php"
PATH+VIEW+THEME+"/ajax/login.php"
My folder structure is:
view
themes
standar
ajax
login.php
js
ajaxInteractions.js
index.phtml
Upvotes: 1
Views: 3012
Reputation: 8020
As stated in the comments, you need to check your path or just use your absolute path like this:
$.post
(
"/view/themes/standar/ajax/login.php",
{
u:Base64.encode(user),
p:Base64.encode(password),
},
function(data)
{
},
"json"
);
And one more thing; it is not always best practice to spread out the code like this ( it's good for PHP and plain JS calls ). For these types of calls, try to keep it more concentrated:
$.post( "/view/themes/standar/ajax/login.php", {
u:Base64.encode(user),
p:Base64.encode(password),
}, function(data) {
/** do your stuff **/
}, "json" );
Upvotes: 1