我有一个动态附加在标签,文本框上的导师列表。
我想要的是当我加载页面时,它会在警告框中显示标签,文本框的值,而不会点击按钮。
以下是我的代码:
的index.html
<table class="table table-hover">
<tbody>
<tr>
<td>
<label class="label label-info" for="">Email</label>
</td>
<td>
<p id="txtemail"></p>
<input id="txtemails" type="text" disabled>
</td>
</tr>
<tr>
<td>
<label class="label label-info" for="">Category</label>
</td>
<td><div id="category"></div></td>
</tr>
<tr>
<td>
<label class="label label-info" for="">Preferred Location</label>
</td>
<td><label id="location" for=""></label></td>
</tr>
<tr>
<td>
<label class="label label-info" for="">Preferred Board</label>
</td>
<td><label id="board" for=""></label></td>
</tr>
<tr>
<td>
<label class="label label-info" for="">Preferred Class</label>
</td>
<td><label id="classes" for=""></label></td>
</tr>
<tr>
<td>
<label class="label label-info" for="">Preferred Subject</label>
</td>
<td><label id="subjects" for=""></label></td>
</tr>
</tbody>
</table>
导师-details.js
$(document).ready(function() {
$.ajax({
url: 'php/tutor-details.php',
type: 'GET',
success: function(data)
{
var result = $.parseJSON(data);
$.each(result, function(key, value){
$.each(value, function(k, v){
if (k === 'image_path') {
$('#tutImg').attr("src",v.slice(3));
}
if (k === 'name') {
$('#name').append(v);
}
if (k === 'contact_number') {
$('#contact').append(v);
}
if (k === 'about') {
$('#about').append(v);
}
if (k === 'email') {
$('#email').append(v);
}
if (k === 'email') {
$('#txtemail').append(v);
$('#txtemails').val(v);
}
if (k === 'location') {
$('#location').append(v);
}
if (k === 'board') {
$('#board').append(v);
}
if (k === 'class') {
$('#classes').append(v);
}
if (k === 'subject') {
$('#subject').append(v);
}
if (k === 'tutor_category') {
if (v === "Diamond") {
$('#category').append(v);
}
}
});
});
}
})
});