I am working on an Asp.Net-Core Razor Page app and I am trying to send from java script some variables to use in my Model. Here is my js code:
const val1 = new Date(document.getElementById('val1').value);
const val2 = new Date(document.getElementById('val2').value);
location.href = "./MyPage/SaveValues" + "&val1=" + val1 + "&val2=" + val2;
In my model:
public void OnGetSaveValues(string value1, string value2)
{
}
The problem is that I receive an error with localhost can't be found. How can I use the values from the url in my model?