0
I would like to know how to solve the request problem between a local and production environment.
Example:
I have a JS function that takes the application content and concatenates with the request.
var ctx = window.location.pathname.substring(0, window.location.pathname.indexOf("/",2));
ctx+'/Portal/listaProdutos'
Locally would: localhost:8080/"application name"/Portal/listProducts
But in production, the requests are taking the duplicate context: www.nomedosite.com/Portal/Portal/listProducts.
How to solve this problem?
Another tip:
I also have request like this: ctx+'/carregaBarSearch'
, and I’m browsing pages with the context /Portal
, www.nomedosite.com/Portal/Home
Oops, in real I just need to know what the dynamic context would look like in JS.
– Matheus
Dear in my design, you must define a global variable and in a given moment use an ajax to get this information from the server. maybe it was the right way.. but then comes the question that you don’t have the server address to use to make an ajax. So I guess.
– Guerra