Nyromodal ajax form / filter docs or COMPLETE examples?

I am one of hundreds of people who are embarrassed by nyroModal's lack of complete examples.

For such a multifunctional plugin, it is difficult to find one comprehensive example of most functions.

I try to open the form in the nyroModal window and submit the form to the page via Ajax, and then close the window based on the response. I know that this should be / simple, but without an example or clear documentation.

While I open it in the window and send it to the window, but ... there is no ajax. (Not sure if nyroModal can handle this. Not sure if I use "filters" since there is no example of how to implement these filters.)

Here is what I have for calling nyroModal:

<script type="text/javascript"> $('.nyroModal').nyroModal( { // not sure if these are needed, but without an example, better start guessing! callbacks: { afterClose: function(nm) { alert('Handled!'); } } }); </script> 

Here is my form, which is called in the nyroModal window: note: creating a class form: nyroModal, makes the form modal within the framework. (will also be a good example)

 <form name="this" method="post" class="nyroModal" action="/vendor/orderDetail.cfm"> <cfoutput><input type="hidden" name="oid" value="#oid#"></cfoutput> <input type="text" name="comment"><input type="submit" value="Accept Product Request"> </form> 

What I want to do is when the user submits the form, I want to send data via AJAX to the "action" page. This will create a JSON response and, depending on the response, close the window. So is this possible with nyroModal? After viewing MUCH MUCH, I can not find any links to this functionality, except for "functions", but it is not shown how to do it.

Can someone give me an example or some docs?

Of course, there should be an example illustrating the use of these functions, namely filters / callbacks.

If someone has examples, this will save us all the time, and NyroDev may stop responding to β€œerrors” that really just confuse people who require a clear set of documentation.

+4
source share
1 answer

I assume you are looking for a manually open form with nyroModal . My answer in Open iframe manually in nyroModal explains how to do this.

So, if you load the page inside the form and use it without ajax, after clicking the submit button, the page will be updated in a modal window (iframe). If you want to send data via AJAX to the "action" page, generate a JSON response and refresh your fashion page, close it ... you should use this code:

  $('input#submit').click(function(e){ e.preventDefault(); // business code if (formToClose) $.nmTop().close(); }); 

Of course, you can also use the afterClose if you need to change something when the modal window is closed.

0
source

Source: https://habr.com/ru/post/1395530/


All Articles