Sk84
12-11-2008, 01:16 PM
Hi everyone!
I'm coding an AJAX site, and I'm using SEO URLs with mod_rewrite. I've managed to make it so that, when a user requests "comics/t/201", he's redirected to "index.php?comic_strip&title=t&strip=201". It was also easy enough to enhance the .htaccess so that the CSS files, the JS scripts and the images are all pointed to correctly (i.e., using paths relative to index.php rather than to comics/t/201).
The problems begin when I try to launch an AJAX request. Here's an example:
function showLoginForm()
{
var url = "src/backend/showLoginForm.php";
var params = "";
var callback = function(http)
{
BetterInnerHTML(element('overlay'), http.responseText);
}
postAjax(url, params, callback);
}
When I use actual URLs (or rewritten URLs without "virtual directories", such as "register.html" which is redirected to "register.php") it all works nice and clean. When I am on "comics/t/201" for example, instead, the XHR (it's hidden inside the postAjax() function) returns a 404 error code.
I understand it's because it is now looking for "comics/t/src/backend/etcetc", while the actual file is in "src/backend". I couldn't find any help about this problem. I don't think it can't be done - it should be something that's done in any SEO site.
Can anyone please shred some light on me?
I'm coding an AJAX site, and I'm using SEO URLs with mod_rewrite. I've managed to make it so that, when a user requests "comics/t/201", he's redirected to "index.php?comic_strip&title=t&strip=201". It was also easy enough to enhance the .htaccess so that the CSS files, the JS scripts and the images are all pointed to correctly (i.e., using paths relative to index.php rather than to comics/t/201).
The problems begin when I try to launch an AJAX request. Here's an example:
function showLoginForm()
{
var url = "src/backend/showLoginForm.php";
var params = "";
var callback = function(http)
{
BetterInnerHTML(element('overlay'), http.responseText);
}
postAjax(url, params, callback);
}
When I use actual URLs (or rewritten URLs without "virtual directories", such as "register.html" which is redirected to "register.php") it all works nice and clean. When I am on "comics/t/201" for example, instead, the XHR (it's hidden inside the postAjax() function) returns a 404 error code.
I understand it's because it is now looking for "comics/t/src/backend/etcetc", while the actual file is in "src/backend". I couldn't find any help about this problem. I don't think it can't be done - it should be something that's done in any SEO site.
Can anyone please shred some light on me?