user435216
user435216

Reputation: 305

Mod_Rewrite + AJAX Posts Doesn't Work Well With Each Other?

I have a system which uses mod_rewrite, making these URLs /index.php?page=login into /login/.

When I post the classic way action="/login/" and I'm done without any problems(the GET parameter tells index.php to let the login module to process the POST data).

However when I use jQuery's post function $.post("/login/",...) instead, it won't work correctly. Does anyone know how to overcome this problem?

Thanks.

Upvotes: 0

Views: 638

Answers (1)

Bob
Bob

Reputation: 11

So your jquery post looks something like this:

$.post('YOURPHPFILE.php', function(data) {
   ...and so on
});

replace it with

$.post('../YOURPHPFILE.php', function(data) {
  ...and so on
});

this "../" should fix it, as your jquery post simply can't locate your php file.

Upvotes: 1

Related Questions