How to not write the full url in javascript ?

Posted by Axel on Stack Overflow See other posts from Stack Overflow or by Axel
Published on 2010-03-17T21:11:27Z Indexed on 2010/03/17 22:51 UTC
Read the original article Hit count: 327

Filed under:
|
|

Hi, I did a Mod rewrite for my website so the URLs looks like this :

http://www.mydomain.com/health/54856

http://www.mydomain.com/economy/strategy/911025/

http://www.mydomain.com/tags/obama/new

So, the problem is that i make AJAX calls to a file here : http://www.mydomain.com/login.php

And i don't want to write the FULL url or even use ../ trick because there isn't a fixed number of folders.

So, what i want now, is something worked for my code to access the login.php from the root whatever the domain name is :

 $.ajax({
 type: "POST",
 url: "http://www.mydomain.com/login.php"
 });

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery