I am encountering an issue with loading a partial view where, upon the second load, the modal window attempts to load the JavaScript file again. This results in errors due to variables being declared multiple times.
Here is the code for the Partial View Controller:
[AllowAnonymous]
public ActionResult _ClaimDetail()
{
return PartialView();
}
JavaScript call to load modal:
$(buttonCharge).ModalPersonalize('show', urlController, 'rebuild title');
PartialView Modal cshtml:
<div class="modalbody">
</div>
<div class="modalbuttons">
</div>
</div>
<script src="@Url.Content("~/JavacriptLogicModal.js")" type="text/javascript"></script>
The error only occurs when opening the modal for the second time. How can I resolve this issue and ensure the JavaScript file is rendered once?
I have tried implementing various validations but none have been successful so far.