开发者

JS Ajax: local vs absolute path issue when using SEO friendly urls

开发者 https://www.devze.com 2023-02-19 01:01 出处:网络
here\'s the thing: i built my site with SEO friendly urls...but i have problem now calling ajax files becaus eth epath is wrong and I cant set an absolute url when i call my files in background..

here's the thing:

i built my site with SEO friendly urls...but i have problem now calling ajax files becaus eth epath is wrong and I cant set an absolute url when i call my files in background..

for instance my page is here (similar to StackOverflow..)

www.domain.com/product/123/this-is-a-product

but my javascripts functions, in folder /js,now they try to reach the files but they cant obvisouly because are set to relative path...

how can i solve this issue??

EDIT: Found this How to g开发者_Python百科et the root path in JavaScript?


When you are using freindly urls, then you have to use path started with /. But then you are starting path from main path.

0

精彩评论

暂无评论...
验证码 换一张
取 消