[英]Submit load page inside a DIV
I created this routine to do a submit and open a page inside a DIV.我创建了这个例程来执行提交并在 DIV 中打开一个页面。 The javascript recognizes the DIV, but the page is opened overlaying the main page, outside the DIV.
javascript 可以识别 DIV,但在 DIV 之外打开的页面覆盖了主页。 Does anyone know what the error could be?
有谁知道错误可能是什么?
Thanks谢谢
<head>
<script>
jQuery($ => {
$('.e-chiedi').on('click', e => {
let $btn = $(e.target);
$.MessageBox({
buttonDone : "Si",
buttonFail : "No",
message : "Mymessage"
}).done(function(){
document.getElementById("formHome").action = "inc_tessera.php#divTessera";
document.getElementById("formHome").submit();
}).fail(function(){
});
});
});
</head>
<body>
<div id="divTessera" style="display: none; ">divTessera</div>
<input id="x" name="x" type="button" class="e-chiedi" data-message="test" />
</body>
When you submit a form (or follow a link) the result will be opened in a browsing context .当您提交表单(或点击链接)时,结果将在浏览上下文中打开。 That can be a window, a tab, or a frame.
这可以是 window、选项卡或框架。 It cannot be a div.
它不能是 div。
You can either:您可以:
target
attribute on the formtarget
属性
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.