我面临一个问题。我无法使用Jquery/PHP
重新加载页面/表单。我在下面解释我的代码。
map.php;
<form class="form-horizontal" method="" role="form" id="frmMappingZone" name="frmMappingZone">
<input type="hidden" id="hidAction" name="hidAction"/>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<div class="col-md-4">
<label for="" class="control-label" style="text-align:left;">Select Exam
Group:</label>
</div>
<div class="col-md-8">
<select class="form-control cmbExamGroup" name="cmbExamGroup" id="cmbExamGroup"
data-live-search="true">
</select>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<div class="col-md-4">
<label for="" class="control-label" style="text-align:left;">Select
Zone:</label>
</div>
<div class="col-md-8">
<select class="form-control cmbZone" name="cmbZone" id="cmbZone"
data-live-search="true">
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-md-2">
<label for="" class="control-label" style="text-align:left;">Examination
Centres:</label>
</div>
<div class="col-md-10 well" style="max-height:220px;overflow-y: auto;">
<div class="row" id="examCentreGroup"></div>
</div>
</div>
</div>
<div class="row">
<div class="form-group">
<div class="col-md-10">
</div>
<div class="col-md-2">
<button class="btn btn-info tooltips" type="submit" id="btnSave" name="btnSave"
title="Save">Add
</button>
</div>
</div>
</div><!-- end row -->
</form>
map.js:
var centreArray = new Array();
$("input:checkbox[name='chkCentre[]']:checked").not("[disabled]").each(function () {
centreArray.push($(this).val());
});
if (centreArray.length < 1) {
$("#btnSave").prop('disabled', false);
//toastr.error('Please Add some centre for Zone mapping.');
}
var cmbExamGroup = $("#cmbExamGroup").val();
var cmbZone = $("#cmbZone").val();
var oper = $("#btnSave").html();
if (oper == 'Add')
toper = 'ADD_ZONE_MAPPING';
else if (oper == 'Update')
toper = 'UPDATE_ZONE_MAPPING';
var institutedata =
{
cmbExamGroup: cmbExamGroup,
cmbZone: cmbZone,
centreArray: centreArray
};
//ajax call to server
$.ajax({
url: "exam_zone_mapping_db.php?type=" + toper + "&_s=" + session,
//url:"exam_zone_mapping_db.php",
type: "GET",
data: institutedata,
//cache: false,
//contentType: false,
//processData: false,
success: function (response) {
//alert(response);
$('#dtblCentreZone').DataTable().ajax.reload();
//console.log('res',response);
var result = JSON.parse(response);
location.reload(true);
if (result.dbStatus == 'SUCCESS') {
$('#frmMappingZone').data('bootstrapValidator').resetForm(true);
toastr.success(result.dbMessage);
if (oper == 'UPDATE_ZONE_MAPPING') {
$('#modalZoneGroup').modal('hide');
}
else {
}
}
else {
toastr.error(result.dbMessage);
}
$('#modalCentreGroup').modal('hide');
if (response == "Error") {
toastr.error('Error in record insert.');
}
else {
}
},
error: function () {
toastr.error('We are unable to process please contact support');
}
此处我的数据正在插入数据库,我需要在提交未发生的表单后重新加载页面。请帮我解决这个问题。
答案 0 :(得分:0)
document.location.reload();
或
window.location.reload();
成功中的其他声明没有任何意义。