aspx后台调用前台jquery_asp.net如何在前台利用jquery Ajax调用后台方法

1

2

3

4

5

6

7

8

9

10 td11 {

12 text-align:center;

13 }

14

15

16 $(function() {17 $("#but").attr("disabled",false);18 });19 //(全/反)选:

20 functiongetChk() {21 if($("#ch").attr("checked")) {22 $(".chk").attr("checked",true);23 }else{24 $(".chk").attr("checked",false);25 }26 }27 //利用AJAX将数据发送到后台并判断数据选中情况方法:

28 functionsendData() {29 varsendValue= "";30 $(".chk").each(function(i,chk) {31 if(chk.checked) {32 sendValue+=$.trim($(chk).parent().parent().find(".getData").text());33 sendValue+= ",";34 }35 })36 if(sendValue.length== 0) {37 alert("请选择需要传输的数据!!");38 return;39 }40 sendValue=sendValue.substr(0, sendValue.length- 1);41 //开始ajax to asp.net:

42 $.ajax({43 type:"post",44 contentType:"application/json",45 url:"Index.aspx/GetAjaxValue",46 data:"{sendValue:'" +sendValue+ "'}",47 beforeSend:function() {48 $("#but").attr("disabled",true);49 },50 success:function(data) {51 alert(data.d);52 }, complete:function() { }, error:function() { }53 })54 }55

56

57

58

59

60

61

62

63 全选

64

65

66 数据67

68

69

70

71

72

73

74 123475

76

77

78

79

80

81

82 567883

84

85

86

87

88

89

90 1234567891

92

93

94

95

96

97

98 8765432199

100

101

102

103

104


105

106

107

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值