How do I pass data from c# to jquery/javascript?

后端 未结 5 654
情书的邮戳
情书的邮戳 2021-01-27 18:42

I have a function that I\'d like to run when the page loads, so either in document.ready or pageLoad.

Using jquery, I\'ll trigger the function using its class name

5条回答
  •  日久生厌
    2021-01-27 19:04

    You can do this way :

    Declare public member into your C# class on code behind

    public string mystring;
    

    Initiate it in Init or Load Event And write that on your js function

    var exp = '<%=mystring %>';
    

    It should work for string. For Dictionnary, you may try to do Ajax

提交回复
热议问题