Modaal icon indicating copy to clipboard operation
Modaal copied to clipboard

Submitting GET or POST values through an ajax request

Open bbrochier opened this issue 8 years ago • 4 comments

I could not find a way to submit POST values to the modal. Is there an option planned for this?

Thanks for this very promissing modal plugin.

bbrochier avatar May 18 '16 10:05 bbrochier

Hi @bbrochier,

Thanks for the kind words and we're sorry for the slow reply!

I'm not sure if we have understood your request, sorry. Is what you want is to have a form in a modal, and when you submit the form, is does an AJAX post and displays the result within the modal?

If so, I've done that on a project, but the AJAX I wrote wasn't part of Modaal. In other words, Modaal just provides the frame which displayed the form, and I wrote my own JavaScript to handle the form submission and display feedback.

My gut says that is probably better than having Modaal try to handle it as a magic feature, as I suspect anything we implement would be quite limited.

Is there an example you could share showing what you what, using a different plugin? Happy to take a look. Also, let me know if I misunderstood altogether!

Regards, Chris

cbotman avatar Jun 10 '16 09:06 cbotman

Thanks for your reply @cbotman, What I was looking for was the equivalent of the "data" setting in colorbox plugin : http://www.jacklmoore.com/colorbox/#setting-data to open the ajax modal with POST datas. I understand your view of keeping Modaal as simple as possible, and our backend team have find a solution of their own to make it work so everything is ok :)

bbrochier avatar Jun 10 '16 11:06 bbrochier

HI @bbrochier,

Ah, cool, thanks for that. I'll leave this ticket open while we take a look. :)

Regards, Chris

cbotman avatar Jun 13 '16 01:06 cbotman

I'm not 100% convinced we'd add something like this to Modaal, but for the interim you could use a data attribute along with the beforeOpen and afterOpen hooks to achieve the same thing. Not the perfect solution, should suffice until something like that is rolled into Modaal itself.

danb-humaan avatar Mar 16 '17 00:03 danb-humaan