$('#ResultDiv').html(result);
而不是在html标签中打印结果,我想在新窗口中打印结果
$.ajax({
type: "POST",
data: { Employeeid: Employeeidv },
url: '@Url.Action("LoadContentInfo","Home")',
success: function (result) {
//print result in new window
}
答案 0 :(得分:0)
您可以尝试window.open
功能:
$.ajax({
type: 'POST',
data: { Employeeid: Employeeidv },
url: '@Url.Action("LoadContentInfo","Home")',
success: function (result) {
//print result in new window
var w = window.open();
$(w.document.body).html(result);
}
});
当然,配置为阻止弹出窗口开放的浏览器将阻止所有这些非法活动。就个人而言,我会使用某种模式(如bootstrap modal
)实现此功能,而不是尝试打开新的浏览器窗口。
答案 1 :(得分:0)
我们走了:
$.ajax({
type: "POST",
data: { Employeeid: Employeeidv },
url: '@Url.Action("LoadContentInfo","Home")',
success: function (result) {
//Open url in new window
window.open("http://yourUrl/", "MyWindow", "height=300,width=300");
}
如果您想在新标签页中打开:
window.open("http://yourUrl", "_blank", "width=600,height=500");