jquery ajax弹出错误

我想显示弹出的动态框。每次点击我都应该从数据库中获取相应的ID并显示详细信息。 我无法在ajax jquery的数据中正确获取公司ID,并且弹出窗口没有显示。

jquery的代码:

我正在使用jquery ui模式弹出

 $.fx.speeds._default = 1000; $(document).ready(function () { $("div[id*='window']").live('click', function (e) { $.ajax({ url: 'Default2.aspx/get_details', type: 'Get', dataType: 'json', data: { id: $(this).attr('id').replace(/window/g, '') }, success: function (data) { $('
').appendTo('body').html('
' + data.comp_name + '
' + data.comp_name + '
').dialog({ modal: true, title: 'Test message', zIndex: 10000, autoOpen: true, width: 460, height: 300, modal: true, resizable: false, closeOnEscape: false, show: "slide", hide: "explode", buttons: { Ok: function () { $(this).dialog("close"); } }, close: function (event, ui) { $(this).remove(); } }); } }); }); });

我的代码背后:

 public void get_details() { DataSet dset = new DataSet(); SqlConnection cn = new SqlConnection(@"Data Source=kar_WS4;Initial Catalog=datas;User ID=sa;Password=****"); string qry = "Select comp_companyId,comp_name,comp_status from Company where comp_companyId=@comp_companyId "; SqlDataAdapter sda = new SqlDataAdapter(qry, cn); sda.Fill(dset); } 

 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CompayJqueryUI.aspx.cs" Inherits="CompanyDisplay.CompayJqueryUI" %>           
Test1




Test2
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Entity; namespace CompanyDisplay { public partial class CompayJqueryUI : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } public Company GetCompanyDetails(int id) { if (true) //authorize { //SqlConnection cn = new SqlConnection(@"Data Source=KURIOS_WS4;Initial Catalog=Dreams;User ID=sa;Password=SageCRMv71"); //string qry = "Select comp_companyId,comp_name,comp_status from Company where comp_companyId=@comp_companyId "; //SqlCommand cmd = new SqlCommand(qry, cn); //SqlDataReader reader = cmd.ExecuteReader(); Company entity = new Company(); entity.Id = 2; entity.Name = "Test"; entity.City = "Bangalore"; //Or //if (reader.Read()) //{ // entity.Id = int.Parse(reader["comp_companyId"].ToString()); // entity.Name = reader["comp_name"].ToString(); // entity.City = reader["comp_status"].ToString(); //} return entity; } else { return new Company(); } } } } using System; using System.Collections.Generic; using System.Web; using System.Web.Services; using System.Web.Script.Services; using System.Web.Script.Serialization; using CompanyDisplay; namespace CompanyDisplay { [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [System.ComponentModel.ToolboxItem(false)] [ScriptService] public class WebService : System.Web.Services.WebService { [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public string GetCompanyDetails(int id) { return new JavaScriptSerializer().Serialize(new CompayJqueryUI().GetCompanyDetails(id)); } } }