javascript - react router - browserhistory and ajax how to get root directory -


so i'm trying set react-router use browserhistory. however, i'm having trouble making sure ajax redirects proper location.

if got link: www.example.com/supermarkets loads expected, once try go further down i.e. www.example.com/supermarkets/map no longer looks backend files in correct location

here's ajax urls (with hashhistory)

url: "src/php/backend.php" 

so works hashhistory , works browserhistory long ends in /supermarkets. trying use more paths e.g. /supermarkets/map try file via /supermarkets/map/src.... i've tried putting / before ajax url e.g. /src/php/backend.php still tries go via map path.

how should fixing this? of course enter full url, e.g.

url: "www.example.com/supermarkets/src/php/backend.php" 

but there alternative this?

here's location of nginx conf

    location /supermarkets {             try_files $uri /supermarkets/index.html;     } 


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -