javascript - Get folder from variable URL with JS -
i developing website, in local url looks this:
{local ip}/{project name}/{project division}/{private folder}/{other folders or files} but when it's online, url looks this:
{domain}/{project division}/{private folder}/{other folders or files} i need make jquery ajax request 1 js file called from
/{project division}/{private folder}/[index file] that file called
/{project division}/{private folder}/{other folders or files} and
/{project division}/{private folder}/{other folders or files}/{other folders or files}/ so need part of url
/{project division}/{private folder}/ for send request there to
/{project division}/{private folder}/ajax_call.js how can part of url js?
any other solution may right.
you should avoid adding logic code behaves differently in dev , prod environments, if reason won't able test behavior of code before goes prod.
instead, have option configure environment runs dev application?
if so, either use different ports or different (sub-)domains different projects, e.g.:
{local ip}:3000/{project division}/{private folder}/{other folders or files}myproject.local/{project division}/{private folder}/{other folders or files}
this allows use absolute path service calls, same way in prod.
Comments
Post a Comment