I have a question. Can somebody explain me, how can I include another .latte file and send dynamic data with it?
I am creating api function, where you should be able to get information about company just by writing it's name. When I click to search, I can see in console that my request is getting through and sending back response, with correct data, but it won't refresh already loaded data.
Some examples of my code:
Javascript:
btn.onclick = function() {
modal.style.display = "block";
var firma = $("#firmaName").val();
console.log( "var is " + firma );
$.ajax('data', {
data: { 'firma' : firma}
});
}
.latte
<!-- The Modal -->
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<span class="close">×</span>
{include 'data.latte'}
</div>
</div>
best way to approach this is by snippets and $.netteAjax().
viz: https://doc.nette.org/en/application/ajax
also, include tag can accept parameters, which are then used within loaded template, like here: https://latte.nette.org/cs/tags#toc-include
I also would recomend, insted of using include of antoher latte file, I would create component for your modal, viz. https://doc.nette.org/en/application/components