Trying to run a Ajax request from a checkout form in woocommerce via a custom plugin
My action was wrong in the ajax request jQuery(document).ready(function () { jQuery(“.redeem_gift_card”).click(function (e) { e.preventDefault(); jQuery.ajax({ type: “post”, dataType: “json”, url: myAjax.ajaxurl, data: { action: “gift_card_redeem” }, // not redeem_gift_card success: function (response) { if (response.type == “success”) { jQuery(“#test”).html(response.type); } else { alert(“something broke”); } }, }); }); });