我在同一页面上有一个包含四个不同部分的创建简历页面,每个部分都有自己的数据库表。我想要提交它以重定向我在提交按钮中给出的另一个ID。
<div class="panel-body">
<ul class="nav nav-tabs nav-justified m-12" role="tablist">
<li id="li1" class="active border-right"><a href="#cinfo" role="tab" data-toggle="tab">Contact Information</a></li>
<li id="li2"><a href="#binfo" role="tab" data-toggle="tab">Basic Information</a></li>
<li id="li3"><a href="#einfo" role="tab" data-toggle="tab">Education Details</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade active in" id="cinfo">
<form method="POST" enctype="multipart/form-data">
<div class="form-group col-md-6 p-r">
<label>Professional Title</label>
<input type="text" name="title" class="form-control" required="required" />
</div>
<div class="form-group col-md-6 p-l">
<label>First Name</label>
<input type="text" name="fname" class="form-control" required="required" />
</div>
<div class="form-group col-md-6 p-r">
<label>Last name</label>
<input type="text" name="lname" class="form-control" required="required" />
</div>
<div class="form-group col-md-6 p-l">
<label>Email</label>
<input type="email" name="mail" class="form-control" required="required" />
</div>
<div class="form-group col-md-6 p-r">
<label>Phone Number</label>
<input type="text" name="phone" class="form-control" required="required" />
</div>
<!-- <div class="col-md-4 p-l"> -->
<a href="#binfo"><button id="btn1" type="submit" name="cinfo_btn" class="btn btn-default btn-block">Next</button></a>
<!-- </div> -->
</form>
</div>
<!-- Basic Information -->
<div class="tab-pane fade" id="binfo">
<form method="POST" enctype="multipart/form-data">
<div class="form-group col-md-6 p-l">
<label>Job Title</label>
<input type="text" name="jobtitle" class="form-control" />
</div>
<div class="form-group col-md-6 p-r">
<label>Position</label>
<input type="text" name="position" class="form-control" />
</div>
<div class="form-group col-md-6 p-l">
<label>Years of Experience</label>
<input type="text" name="exp" class="form-control" />
</div>
<a href="#einfo"><button id="btn2" type="submit" name="einfo_btn" class="btn btn-default btn-block">Next</button></a>
<!-- </div> -->
</form>
</div>
</div>
答案 0 :(得分:0)
最好的方法是使用ajax。 使用ajax然后在响应成功回调中提交第一个表单 只需在下一个标签上触发点击事件,然后它就会显示您指定的标签。
这会将标签转到第二个标签。
request1 = $.ajax({
url: "url",
type: "POST",
data: yourdata
});
request1.done(function (response, textStatus, jqXHR) {
$('#li2').trigger('click')
});
这会将标签转到第3个标签页。
request2= $.ajax({
url: "url",
type: "POST",
data: yourdata
});
request2.done(function (response, textStatus, jqXHR) {
$('#li3').trigger('click')
});