I have the following situation
I have a view with a certain field, when clicking a button it calls a certain view, it would need that when clicking on a button of that other view, it called that original view with the form filled as it was.
I thought that if I saved what was filled before, and clicking the button of that other view, the filled field would appear, but it is coming empty.
script
var descricao;
$('body').on('click', '#btnNovaAreaReclamacao', function () {
descricao = $("#Descricao").val();
});
$('#btnSalvarNovaAreaReclamacao').on('click', function () {
$("#Descricao").val(descricao);
console.log(descricao);
});
second view html
<body>
<div>
<p>
<a href="#" class="btn btn-success" id="btnSalvarNovaAreaReclamacao" data-action="Create" data-toggle='tooltip' data-placement='top' title='Cadastrar'>
<span class="glyphicon glyphicon-plus"></span>
Nova
</a>
</p>
</div>
</body>
When I put it for example, it works by clicking on the description field but it's not the effect I need
//nome do campo que eu estou usando
$('#Descricao').on('click', function () {
$("#Descricao").val(descricao);
console.log(descricao);
});
I've also tried
$('body').on('click', 'btnSalvarNovaAreaReclamacao', function () {
$("#Descricao").val(descricao);
console.log(descricao);
});
How do I click the button to load this data correctly?