N
N
NataliaCh2017-10-06 16:58:24
fancyBox
NataliaCh, 2017-10-06 16:58:24

How to pass parameters to Ajax script in fancybox3?

I'm reading the fancibox documentation and I can't figure out how to pass parameters to my ajax script, the results of which should be reflected in the fancibox pop-up window.
here's what's in the docs:

<a data-fancybox data-type="ajax" data-src="my_page.com/path/to/ajax/" href="javascript:;">
  AJAX content
</a>

And not a word about the possibility to pass some parameters. Well, that is, the GET method is possible, apparently ... But what if there is a large array of data?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2018-02-21
@NataliaCh

In fact, everything is simple:

$.fancybox.open({
   src: "ваш_урл",
   type: "ajax",
   ajax: {
       settings: {
           type: "POST",
           data: {
               myparam1: "value1",
               myparam2: "value2"
           }
       }
    }
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question