I want to get data from <input>
and <textarea>
fields and redirect to other URL controller but I'm stucking in writing logic for it
Here is my phtml file
<a class="action print" href="#" id="click-me" data-mage-init='{"myjs": {}}'>Custom popup</a>
<div id="popup-modal" >
<div id="custom-modal">
<label>
Name:
<input type="text" name="name" id="name1">
</label>
<label>
Content Invoice:
<textarea name="content"></textarea>
</label>
</div>
</div>
and my js file in frontend/web folder
require(
[
'jquery',
'Magento_Ui/js/modal/modal'
],
function(
$,
modal
) {
var options = {
type: 'popup',
responsive: true,
innerScroll: true,
buttons: [{
text: $.mage.__('Submit'),
click: function () {
// get input data here and redirect to another page
}
},
{
text: $.mage.__('Close'),
class: 'mymodal1',
click: function () {
this.closeModal();
}
}
]
};
var popup = modal(options, $('#popup-modal'));
$("#click-me").on('click',function(){
$("#popup-modal").modal("openModal");
});
}
);