How to post html data using jquery?
I need to grab a table's html and post it to a page where the table will be exported as xls, but I can't get it to work, I tried to pass the data as object, no luck, then I tried to pass it as string, still no luck (is it because the table too large?)
//var tblReportResultData= "id=tblReportResult&name=tblReportResult&html=" + escape($("#tblReportResult").html()); //,
var tbl开发者_如何学GoReportResultData = {id:"check",html:$("#tblReportResult").html()}
$.ajax({
url:'ajax.aspx',
type:'POST',
data:tblReportResultData,
dataType:'html',
success:function(msg){
alert("waterver");
},
error: function(xhr, text, err){
alert("Error:" + text);
}
});
I found out the problem, it's because post html code could be dangerous and the system automatically blocked it, after I used escape(), it worked.
精彩评论