How to pass a value to razor variable from javascript variable?

后端 未结 7 1017
小鲜肉
小鲜肉 2020-11-27 19:43

How to pass a value to razor variable from javascript variable, is it possible asp.net mvc razor view engine?

@{
    int a = 0;
}



        
7条回答
  •  伪装坚强ぢ
    2020-11-27 20:33

    Step: 1 Your Html, First Store the value in your localstorage using javascript then add the line like below ,this is where you going to display the value in your html, my example is based on boostrap :

    
    

    Step:2 Javascript

     $('#stringName').replaceWith(localStorage.getItem("itemName"));
    

提交回复
热议问题