I've got this multi-line javascript snippet:
$.getJSON('@Url.Action("ReconBases")',
{ modelId: selectedModelId },
function(selectItems) {
buildDropDown('#SelectedReconId', selectItems);
});
I want to conditionally add this script to the page based on a view model variable, like this:
@if ( Model.GetBases )
{
<snippet above>
}
Can anyone tell me if this is possible and the right syntax for doing this? I've tried using @: and Html.Raw, but I can't seem to get the right format for it to work.