NETTE-LATTE: Include on click

DatZiggyZig
Member | 1
+
0
-

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:

.latte:

<!-- The Modal -->
<div id="myModal" class="modal">
    <!-- Modal content -->
    <div class="modal-content">
        <span class="close">&times;</span>

            {include 'data.latte'}

    </div>
</div>

javascript:

btn.onclick = function() {
modal.style.display = "block";
var firma = $("#firmaName").val();

console.log( "var is " + firma );

$.ajax('data', {
    data: { 'firma' : firma}

});

}
dkorpar
Member | 121
+
0
-

You probably need this:
https://doc.nette.org/en/3.1/ajax

see also https://naja.js.org/