用jQuery向div中添加html文本内容的简单实现

来源:互联网 发布:nginx 多个ssl 编辑:程序博客网 时间:2024/05/17 22:19

1、前台代码

function   PoeviewExcel()

{

      $.ajax({

          url:"send/GetImportReport",

          type:"post",

          success:function(data){

               var divshow=$(''#showInfo2);

                divshow.text("");   //清空数据

                divshow.append(data);   //添加html内容,不能用Text 或Val

                 divshow.dialog({

                     title:"短信群发系统",

                     height:250,

                     width:580

                 });

          }

      })

}


2、后台(主要)


[HttpPost]

public string GetImportReport()

{

    DataTable dt=this.ImportExcel();

    string content=string.Empty;

    

  content = @"<table width='550' border='0' cellspacing='0' cellpadding='0' bgcolor='#D2D2D2'>"
     +" <tr bgcolor='#336699'>"
     +" <td align='center'><strong>序号</strong></td>"
     +" <td align='center'><strong>目标手机号</strong></td>"
     +" <td align='center'><strong>发送内容</strong></td>"
     +"</tr>";
 content+="</table>";
 return content;

}

说明:

divshow.append(data);  //添加html内容,不能用Text或Val

用after();会在该div中不断追加信息。

如果用Text:会显示加载的文本内容

如果用Val:点击链接第一次为空窗口,在点击才出现数据显示

0 0
原创粉丝点击