I have defined index as <%var index = 0;%> This is at the top of the body of HTML so I can use it throughout as a global variable. and I want to assign value of $(this).val() to <% index %>. I have tried multiple times but am not able to figure it out. I am using Node.js in backend and EJS in front end.
<script>
$("#agency").on("change", function () {
var $modal = $('#myModal');
if($(this).val() !== '0'){
<% index %> = parseInt($(this).val()); ????
}
$modal.modal('show');
}
});
</script>
via Jay N Patel
No comments:
Post a Comment