Created by @57g49d in Q&As
@57g49d
@57g49d

Hello,

I wonder if its possible to submit form in background same as in normal ajax request. Problem is the new request always cancel/abort the previous one.

I'm submiting via javascript

_stack.push(function(di) {               
  di.getService('formLocator').getForm(formid).submit();
});

is there somewhere option to add backgoud:true same as in

di.getService('page').open();

or submit the form by other way?

Thanks a lot!

@jahudka
@jahudka

Hi, I believe you can do this using something like this:

_stack.push(function(di) {
    const form = di.getService('formLocator').getForm(formId);

    di.getService('page').open(form.getElement().action, form.getElement().method, form.serialize(), {
        background: true,
    });
});

I should note though that Nittro isn't really maintained anymore, perhaps you might want to consider one of the alternatives like Naja.

Sign in to post a reply