Front Code:
<link href= "Http://www.cnblogs.com/Content/themes/base/jquery-ui.css" rel= "stylesheet" type= "Text/css"/>
<script src= "Http://www.cnblogs.com/Scripts/jquery-1.4.4.min.js" type= "Text/javascript" ></script>
<script src= "Http://www.cnblogs.com/Scripts/jquery-ui.js" type= "Text/javascript" ></script>
function Poeviewexcel () {
$.ajax (
{
URL: "Send/index",
Type: "Post",
Success:function (data) {
var divshow = $ ("#showInfo2");
Divshow.text ("");//Clear data
Divshow.append (data); Add HTML content, not 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>
Backstage (Main):
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> serial number </strong></td>"
+ "<TD align= ' center ' ><strong> target phone 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, not text or Val
Of course with after (), the information is appended to the Div.
If you use text: Displays the loaded text content;
If you use Val: Click the link for the first time for an empty window, and then click to display the data
Add HTML text content to the div with jquery