Load formular with ajax and display it in fancybox lightbox

Just a code snippet:

The link:

<a href="#" id="the-opener-link" data-url="/link/to/form">Open form</a>

The JavaScript:

$('#the-opener-link').click(function(event) {

        type: 'ajax',
        afterShow: function() {
            $(".fancybox-inner form").bind("submit", function () {
                    type: "POST",
                    cache: false,
                    url: $(this).attr('action'),
                    data: $(this).serializeArray(),
                    success: function (data) {
                return false;

    return false;

I’m using a data attribute to protect the form being indexed and used by bots/search engines.

Sven Wappler

TYPO3 Experte, symfony, Magento, SEO, Frontend und Backend

Das könnte Dich auch interessieren …

Schreibe einen Kommentar