asp.net mvc 4 - Use server side variable in jquery MVC 4 -


i'm having server side global variable in mvc4 application.

and need use variable in view using j query.

can 1 tell me how can use variable in view using j query.

variable

namespace saif.models {     public class clsglobal     {         static string _absoluterurl;         public static string absoluterurl         {             { return _absoluterurl; }             set { _absoluterurl = value; }         }     } } 

in j query $(document).ready

var url = @saif.models.clsglobal.absoluterurl; 

try adding '' url in javascript:

var url = '@saif.models.clsglobal.absoluterurl'; 

the url contain value of absoluteurl.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -