我已经尝试了 4 天来解决这个问题。但我无法将 json 数据返回到新的标签页。
我的代码:
<script type="text/javascript">
function CustomerId() {
var url = "Home/PanelGoster"; // My URL
var veri = {
Id: Id.GetValue(),
};
$.ajax({
url: "/Home/PanelGoster",
type: "POST",
dataType: "json",
contentType: 'application/json',
data: JSON.stringify(veri),
success: function (mydata) {
if (mydata.error6 == true) {
}
else { // Success
var something = window.open(url, '_blank'); // Problem Here , it does not work
something.focus(); // Problem Here
("#MusterilerGetir").html(mydata); // Problem Here, should be displayed in a new tab
}
},
error: function () {
}
});
return false;
}
</script>
控制器:
public ActionResult PanelGoster(MyModel model)
{
var stringView = RenderRazorViewToString("PartialView", MyModel());
return Json(stringView, JsonRequestBehavior.AllowGet);
}
}