[英]I wish to send the result of request Ajax on my form HTML - i have the data in 'response.labo'
我希望將我的數據從 ajax 結果發送到我的表格 HTML。 數據在“response.labo”中,我希望將所有數據發送到我的表格。 感謝我們的幫助
這是我的代碼: Ajax 代碼:
$.ajax({
type: "POST",
url: "/controller/edit_labo.php",
data: {
action: "editer",
dm_data
},
success: function (response) {
DM_LIST = response.labo;
console.log(response.labo);
HTML 代碼:
<div class="row">
<div class="col-lg-1">
Matriculle :
</div>
<div class="col-lg-3">
<input type="text" class="form-control" name="matriculle" placeholder="Matriculle" id='matriculle'>
</div>
</div>
<br>
<div class="row">
<div class="col-lg-1">
Prénom :
</div>
<div class="col-lg-3">
<input type="text" class="form-control" name="prenom" id="prenom" placeholder="Prénom" autocomplete="off">
</div>
</div>
$("#matriculle"); // 這里是通過 id 找到的表單域
.val(值); //這里是設置字段值的方法
response.labo //這是你的回復,因為你沒有提供結構,我猜你里面有一些屬性。
success: function (response) {
DM_LIST = response.labo;
console.log(response.labo);
$("#matriculle").val(response.labo.propertyname);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.