-1
Hello, I am loading a page into a div through AJAX, so that the data can be loaded without the need to reload the page. However, I noticed that the javascript that is on this loaded page is not executed. I need to have some scripts run only when the page referring to it is loaded into this div. I’m trying this way:
<li onclick="callref('exchange'); marcaLinha();" class="nav-item"><a href="#" class="nav-link"><i class="fa fa-exchange"></i><span>Comércio</span></a></li>
In this line, "callref" is the function that puts the "exchange" page inside the div. This function is working normally. The "bookmarkLine" function is a code snippet that is supposed to select the row of a table that is inside the exchange page, however I have the following error: Uncaught Referenceerror: markLine is not defined at Htmllielement.onclick
The "little mark" function has the following code:
function marcaLinha() {
var tabela = document.getElementById("tab_comandas");
var linhas = tabela.getElementsByTagName("tr");
for (var i = 0; i < linhas.length; i++) {
var linha = linhas[i];
linha.addEventListener("click", function() {
//Adicionar ao atual
selLinha(this, false); //Selecione apenas um
//selLinha(this, true); //Selecione quantos quiser
});
}
The above function was made based on a tutorial I saw on the internet, while running it in a separate file for testing it worked properly, however while doing so I am having problems.
The two functions are in the same javascript file, so I think the failure is not referring to the file import, since the function "callref" works correctly.