0
我有一個數據庫MySQL。我們有單選按鈕的個人詳細信息HTML表格。我想用AJAX和PHP修改表格數據。選中單選按鈕後單擊修改按鈕,然後在BOOTSTRAP MODAL中打開檢查的表格行。從表中檢索值,但其在MODAL.i沒有顯示需要AJAX後的代碼獲得成功MODAL應該打開,但這裏莫代爾不工作只形成顯示 兩個文件:檢查錶行應該在BOOTSTRAP MODAL中打開
兩個文件: 1)修改。 PHP
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modifyModal" id="emp_modify">Modify</button>
$.ajax({
type: "POST",
url: 'modify1.php',
data: {option:'modify',empID:id},
success: function (data) { //after AJAX get succes MOdal SHould open
//$('#emp_modify1').html(data);
$("#getCode").html(data);
$("#getCodeModal").modal('show');
}
});//end of ajax
}
else {
alert("Select a row first");
}
})
});
</script>
</body>
2)modify1.php
<form class="form-horizontal" id="edit" name="edit">
<div class="form-group">
<input id="id" name="edit" class="form-control" type="hidden" value="<?php echo $elements['emp_id']; ?>"
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="form-field-1"> Name </label>
<div class="col-sm-9">
<input id="uid" name="edit" class="form-control" type="text" value="<?php echo $elements['name']; ?>">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="form-field-1">gender</label>
<div class="col-sm-9">
<input id="semail" name="edit" class="form-control" type="text" value="<?php echo $elements['gender']; ?>">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="form-field-1">gender </label>
<div class="col-sm-9">
<input id="semail" name="edit" class="form-control" type="text" value="<?php echo $elements['gender']; ?>">
</div>
</div>
</form>
ajax響應後得到什麼?你可能會分享其他JavaScript代碼嗎? – itzmukeshy7