Foreground code:
<link href= "Http://www.jb51.net/Content/themes/base/jquery-ui.css" rel= "
stylesheet" type= "Text/css"/> <script src= "Http://www.jb51.net/Scripts/jquery-1.4.4.min.js" type= "Text/javascript" ></script>
<script src= "Http://www.jb51.net/Scripts/jquery-ui.js" type= "Text/javascript" ></script>
function Poeviewexcel () {
$.ajax (
{
URL: "Send/index",
type: "Post",
success:function (data) {
var divshow = $ ("#showInfo2");
Divshow.text ("");//empty data
divshow.append; Add HTML content, you cannot use text or Val
divshow.dialog ({
title: "Bulk SMS System",
height:250,
width:580
});
}
}
);
return false;
}
<a href= "#" onclick= "return Poeviewexcel ()" > Preview Data </a>
<div id= "Divpreview" style= "Display:none" >
<text id= "ShowInfo2" ></text>
</div>
Background (main):
public string Getimportreport () {DataTable dt = this.
Importexcel ();
string content = String.Empty; Content = @ "<table width= ' border= ' 0 ' cellspacing= ' 0 ' cellpadding= ' 0 ' bgcolor= ' #D2D2D2 ' >" + "<tr Bgcolo R= ' #336699 ' > ' + ' <td align= ' center ' ><strong> serial number </strong></td> ' + ' <td align= ' cent Er ' ><strong> target mobile number </strong></td> ' + ' <td align= ' center ' ><strong> Send content </strong
></td> "+" </tr> "; for (int i = 0; i < dt. Rows.Count; i++) {content + = "<tr>" + "<td width= ' align= ' center ' >" + i.tostring () + "</td>" + " <TD width= ' align= ' center ' > ' + dt. Rows[i][0]. ToString () + "</td>" + "<td width= ' >" + dt. ROWS[I][1].
ToString () + "</td>" + "</tr>";
Content + = "</table>";
return content; }
Description
Divshow.append (data); Add HTML content, do not use text or Val
Of course, after (), the information will be continuously appended to the Div.
If you use text: Displays the loaded textual content;
If you use Val: Click on the link for the first time empty window, then click to appear data display,
The above article with jquery to add HTML text content in the Div is a simple implementation of the small series to share all the content, hope to give you a reference, but also hope that we support cloud habitat community.