利用ajax在javascript中获取后台的值

    <script type="text/javascript">

        function login() {

            var sa = WebForm1.Hello().value;

            $("#inputT").attr("value", sa);

            var sa2 = WebForm1.Hello2().value;

            $("#Text2").attr("value", sa2);

            var s1 = WebForm1.Hello1().value;

            var s11 = eval(s1);

            alert(s11[0]);

        }

    </script>
 [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]

         public string Hello1()

         {

             return "[5,4,3,2,1]";//这种可以

             //return " ";

         }

 

protected void Page_Load(object sender, EventArgs e)

        {

            Ajax.Utility.RegisterTypeForAjax(typeof(WebForm1));

        }

       [Ajax.AjaxMethod(Ajax.HttpSessionStateRequirement.ReadWrite)]

        public string GetQuYu2(string name)

        {}

 

你可能感兴趣的:(JavaScript)