I have the following JavaScript code in Index.cshtml
function getActivity()
{
var collection = document.getElementsByClassName("skill-icon-selected");
const splitCollection = new Array;
for (var i = 0; i < collection.length; i++)
{
var split = collection[i].id.split("-");
splitCollection.push(split[0]);
}
console.log(splitCollection);
}
I want to pass the array splitCollection to Index.cshtml.cs to use
public List<Activity> allActivities = new List<Activity>();
public void OnGet()
{
allActivities = _context.Activities.ToList();
foreach (var activity in allActivities)
{
if (splitCollection.contains(activity.Skill))
{
//Do stuff
}
}
How would I access splitCollection in my cshtml.cs or the data in splitCollection to be usesd in c#
JSobject in a local storage and then access it on your othercshtmlview.