Siz S
Siz S

Reputation: 866

Relative url in php

I'm sending an ajax request with relative url

 $.post("wp-content/themes/site/function.php", {

    }, function (data) {});

It's working fine if my url is http://yourdomain.com/page. But if the url is http://yourdomain.com/page/

then it's sending http://yourdomain.com/page/wp-content/themes/site/function.php. but I want http://yourdomain.com/site/wp-content/themes/function.php

Upvotes: 2

Views: 92

Answers (1)

adamb
adamb

Reputation: 4883

try with a leading /:

$.post("/wp-content/themes/site/function.php", {}, function (data) {});

Upvotes: 6

Related Questions