In my view I have a JavaScript method which I’d like to call passing in data from my model.
Here’s my code
@for(var i = 0; i < @Model.SearchCriteria.Locations.Count; i++) {
locationLog(@Model.SearchCriteria.Locations[i]);
}
The JavaScript method is locationLog. Naturally, this is throwing an error saying that this method is not recognised. What must I do?
Have you tried wrapping your call to “locationLog” in a script tag?