日期:2014-05-17  浏览次数:20525 次

Ajax调用后台方法,提示对象未定义,如何解决
前台页面如下:
C# code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Province.aspx.cs" Inherits="Admin_Channel_Province" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>编辑开通省份</title>
    <link href="../../css/Public.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
        function addch() {
            if (confirm("您确认要提交所选省份吗?")) {
                var List = "";
                var strID = document.getElementsByName("checkbox1");
                for (var i = 0; i < strID.length; i++) {
                    if (strID[i].checked) {
                        List += strID[i].value + ",";
                    }
                }
                if (List == "") {
                    alert("请选择省份");
                    return;
                }
                var ch = document.getElementById("ch").value;
                var ct = document.getElementById("ct").value;
                Admin_Channel_Province.addprovince(List, ch, ct, GetCallBack);  //这里提示Admin_Channel_Province未定义
            }
            function GetCallBack(response) {
                var result = response.value;
                if (result == "OK") {
                    alert("编辑成功");
                }
            }
        }
    </script>
</head>
<body>
<script src="../../js/Calendar.js" type="text/javascript"></script>
    <form id="form1" runat="server">
    <div class="l_f_top">
        <div class="l_f_top_left_div"><img alt="" src="../../images/tab/tb.gif" width="16" height="16" /></div>
        <div class="l_f_top_right_div">编辑省份</div>
    </div>
    <div id="divList" class="l_f_body">
        <div align="left">
            <input type="checkbox" value="-1" name="allID" id="allID" onclick="javascript:selectAll(this.form,this.checked)" />全选
        </div>
        <input type="checkbox" name="checkbox1" value="1" />福建
        <input type="checkbox" name="checkbox1" value="2" checked="checked" />广东
        <input type="checkbox" name="checkbox1" value="10" checked="checked" />贵州
        <input type="checkbox" name="checkbox1" value="11" />陕西
        <input type="checkbox" name="checkbox1" value="12" />青海
        <input type="checkbox" name="checkbox1" value="13" />海南
        <div class="center l_f_body_foot">
            <input type="button" onclick='addch();' value="提 交" class="button_60" />
            <input type="button" onclick='javascript:window.history.go(-1);' value="返 回" class="button_60" />
        </div>
    </div>
    <input type ="hidden" id="ch" name ="ch" value ="<%=CH%>"/>
    <input type ="hidden" id="ct" name ="ct" value ="<%=CT%>"/>
    </form>
</body>
</