(function ($) { 'use strict'; $(".itella-card-btn").click(function () { // clear feedback $(" #itella_plugins_form_feedback ").html( '' ); // show form, selected platform text $("#itella-form-title").show(); $("#register_itella_plugin_download_form").show(); $('#itella-selected-platfrom').show(); let logoPath = $(this).data('logopath'); let platform = $(this).data('platform'); // load modal logo $("#itellaModalLogo").attr('src', logoPath); // remove added platform options $('#itellaPlatformDropdown option').each(function() { if ( !$(this).attr('disabled') ) { $(this).remove(); } }); // add platform options $.each(platform, function (platformVersion,data) { $('#itellaPlatformDropdown') .append($("") .attr("value", data.id) .text(data.name)); }); }) // equal items height $(function () { $('.equal-item').matchHeight(); }); // handle form submit $( '#register_itella_plugin_download_form' ).submit( function( event ) { event.preventDefault(); // serialize the form data let ajax_form_data = $("#register_itella_plugin_download_form").serialize(); //add our own ajax check as X-Requested-With is not always reliable ajax_form_data = ajax_form_data+'&ajaxrequest=true&submit=Submit+Form'; $.ajax({ url: params.ajaxurl, // domain/wp-admin/admin-ajax.php type: 'post', data: ajax_form_data }) .done( function( response ) { // response from the PHP action let el = $( '
' ); el.html(response); if ($(" #itella_plugins_errors ", el).length) { $(" #itella_plugins_form_feedback ") .html( response ) .attr('class', 'itella-plugins-info my-4'); } else { $(" #itella_plugins_form_feedback ") .html( `