You are missing a fundamental understanding here. I already answered a version of this question by you, however I did not think you misunderstood this point.
You cannot pass anything from javascript to razor without going through the server.
That is because the razor is executed server side (hence the c# in it). The controller is called, that class is instantiated, then the method is invoked which matches the action requested, and then a view is returned. When the view is returned, the c# code in the view is executed. Once all code has been executed, it issues the html page in the response and then the javascript runs on the client. For you to get from javascript to razor, you would have to issue a new request to go through that path from the beginning in order to come back out in the end.
Solve this issue server side.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…