Reputation: 1809
I have c# variable check
that I want to use in my jquery if condition. But I am getting error
Uncaught ReferenceError: DGSCRM is not defined
where DGSCRM
is the value present in my c# variable check
.
@{
string check = Model.ChangeAddress.ControllerName;
}
<script type=text/javascript>
$(document).ready(function ()
{
if(@check == "DGSCRMAPI")
{
$('#logo').hide();
}
});
</script>
Is it the right approach to mix c# and jquery code in views?
Upvotes: 2
Views: 6615