Question

I've been trying to make my button open a new tab, the same way my form is doing but I've discovered that window.open() doesn't work on POST requests. SO, is there any other way I can make my button open a new tab instead of opening in the parent tab?

enter image description here

Was it helpful?

Solution

I just needed to place the target="_blank" like so

<form id="annex" method="POST" target="_blank" action="checkbutton/index/display">
    <input name='monkey' type="hidden" value="<?= $block->getProduct()->getSku(); ?>"/>
    <button type="submit" class="action primary tocart" id="checkstores"><?=__('Check Stores')?></button>
</form>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top