response从那传过来了  你贴出来没用啊  
ajax哪一块你怎么做的

解决方案 »

  1.   

    webservice: 
        [WebService(Namespace = "http://tempuri.org/")] 
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] 
        [ToolboxItem(false)] 
        [System.Web.Script.Services.ScriptService] 
        public  class wsAirwayArea : System.Web.Services.WebService 
        {         [WebMethod] 
            public  DataSet GetAreaByAirway(string airway) 
            { 
                CZY.BLL.ALINKA bll = new CZY.BLL.ALINKA(); 
                CZY.Model.ALINKA model = new CZY.Model.ALINKA(); 
                
                DataSet ds=new DataSet(); 
                ds = bll.GetList("   airway='" + airway + "'"); 
                 
                return ds;         }         [WebMethod] 
            public string HelloWorld() 
            { 
                return "Hello World"; 
            } 
        } 
    /////////////////////////////////////////////// 
        function clicked() 
            { 
            var airway=document.getElementById(" <%=DDLSAIRWAY.ClientID%> ").value;          web.WebService.wsAirwayArea.GetAreaByAirway("ca",onSucceeded);//这里是测试的时候使用的值。         } function   onSucceeded(response)//response在debug windows中可以看到返回ca的数据库中的数据。 
                    {  
                        if   (response.value   !=   null                          {                                          
                                            debugger;  
                                    var   ds   =   response.value;  
                                            if(ds   !=   null   &&   typeof(ds)   ==   "object"   &&   ds   !=   null)  
                                            {                                          
                                                    for(var   i=0;   i  <ds.Tables[0].Rows.length;   i++)  
                                         {  
                                                 var   name=ds.Tables[0].Rows[i].AREA;  
                                           var   id=ds.Tables[0].Rows[i].AIRWAY;  
                                           document.getElementById("ctl00_ContentPlaceHolder1_DDLSAIRWAY").options.add(new   Option(name,id));  
                                         }                                  }                                  
                                    return                  } 
      

  2.   

    ajax显然不能直接返回DataSet给JS
    你必须将期转换为字符串后再输出
    为了方便处理,你最好把字符串格式化为JSON格式或数组格式,这样便于JAVASCRIPT接收处理.
      

  3.   

    哪有返回dataset出来的呀,这个不太好处理啊,还是用数组或者json格式的数据吧,不然js也不知道怎么解析
      

  4.   


    //把DataSet转换成json格式  转换成JS用 var list = new Function("retrun "+xmlHttp.responseText+"")
    public string ConvertToJson(System.Data.DataSet ds) {
    StringBuilder retVal = new StringBuilder();
    int TableCount = 0, RowCount = 0, ColumnCount = 0;
    retVal.Append("{");
    foreach (System.Data.DataTable dt in ds.Tables) {
    TableCount++;
    retVal.AppendFormat("{0}:[", dt.TableName);
    foreach (System.Data.DataRow row in dt.Rows) {
    RowCount++;
    retVal.Append("{");
    foreach (System.Data.DataColumn column in dt.Columns) {
    ColumnCount++;
    retVal.AppendFormat("{0}:\"{1}\"{2}", column.ColumnName, row[column].ToString().Trim().Replace("'", "\\'").Replace("\\r", "<br/>").Replace("\\n", "<br/>").Replace(System.Environment.NewLine, "<br/>"), ColumnCount == dt.Columns.Count ? "" : ",");
    }
    ColumnCount = 0;
    retVal.Append("}");
    retVal.AppendFormat("{0}", RowCount == dt.Rows.Count ? "" : ",");
    }
    RowCount = 0;
    retVal.Append("]");
    retVal.AppendFormat(TableCount == ds.Tables.Count ? "" : ",");
    }
    retVal.Append("}");

      

  5.   

    将你的dataset转换成json 这样js就可以进行接收和解析了