1
I am capturing a certain value of the URL through Javascript, but I’m having difficulty at some point. Follow below.
var url = window.location.href;
var page = url.split('/');
var page = page[page.length-1];
var arrayItens = new Array();
Considering for example that the URL is http://google.com/pagina.current, when executing the above code the return will be given "page.current". No news.
However, when I add parameters beyond the "current page", eg: "http://google.com/pagina.atual?origem=teste", it will capture the "current page? origin=test". I need ONLY the "current page.".
Does anyone know how I can do this by following the quoted passage?
You can use a split even
"pagina.atual?origem=teste".split('?')[0]
– Pedro Camara Junior
Kaleb, some of the answers solved your question?
– Sergio
Sergio, yes. Pedro Camara’s comment right after the question was posted helped a lot. I didn’t answer before for the rush.
– Kaleb Figueiredo