日期:2014-05-16 浏览次数:20798 次
<script src="jquery.js"></script> <script type="text/javascript"> var a = "aaaa"; $(function () { $.ajax({ type: "POST", contentType: "application/json", url: "Default.aspx/Time", data: '{"abc":"' + a + '"}', dataType: 'json', success: function (result) { alert(result.d); } }); }); </script>
[WebMethod] public static string Time(string abc) { return abc; }
var a = "aaaa"; var b = "bbbb"; $(function () { $.ajax({ type: "POST", contentType: "application/json", url: "Default.aspx/Time", data: "{a1:'" + a+ "',a2:'" + b + "'}", dataType:'json', success: function (result) { alert(result.d); } }); });
[WebMethod] public static string Time(string a1,string a2) { return a1+a2; }