This is the error I am getting:
jquery-3.7.1.min.js:2 jQuery.Deferred exception: RIC is not defined ReferenceError: RIC is not defined
Here is my simple javascript function
<script>
function additionalData()
{
return {
employeeId: @Model.EmpId, //Able to retrieve this property
terminalId: @Model.ServiceCenter //If I include this property, it throws the exception above
}
}
</script>
If I include the @Model.ServiceCenter
, I get the error above.
If I hard-code it to be a value such as 'RIC', it works with no issue.
If I add a breakpoint, I can see that the model does contain a value for both properties.
Any idea why I can't retrieve the @Model.ServiceCenter property even though I can see there is a value associated with it?
Please try to use:
terminalId: '@Model.ServiceCenter'
This will work as the value RIC coming in this is string
and your employeeId
is integer