Created by @barglm in Q&As
@barglm
@barglm

Hi again, I am processing our code and it works with nittro more and more. Now, I am confused with this task:

I have order form and I am able to select a company, when I do this, I want the prefill contact details in the form. I was able to do it with nette ajax, which handled the control redraw.

$('form#billing-form select#billing-select').on('change', (el) => {
    $.nette.ajax({
        url, // this calls handle
        data: params,
    });
});

I am not really sure how to do same thing with Nittro.

@jahudka
@jahudka

Hi, well, assuming that the contact details are wrapped in a snippet, you could do something like this:

$('form#billing-form select#billing-select').on('change', (el) => {
    di.getService('page').open(url, 'POST', params, {
        background: true,
        transition: false,
        history: false
    });
});

and just redraw the snippet in the appropriate handler

Sign in to post a reply