0
我有一个HTML表格行,其中包含根据需要自定义的混合内容单元格。我想将此行动态添加到HTML表格。但是js中出现了一个错误。将自定义表格行添加到PHP中的HTML表格中
php的功能如下
function addRowtoTable(){
$tblRow = '<tr>
<td><input type="checkbox" name="record"></td>
<td for="section"><select name=\'section\' id=\'section\' class=\'form-control\' >
<?php echo fill_sectionName($conn, $userRow[\'userName\']); ?></select></td>
<td for="fileRef"><input name ="fileRef" id="fileRef" class="form-control ui-autocomplete-input" autocomplete="on" placeholder="Enter File Reference"></td>
<td for="datepicker"><input class=\'form-control\' type="text" id="datepicker" placeholder="Mail Date"></td>
<td for="section"><?php echo fill_SecurityClass(); ?></td>
<td for="section"><?php echo fill_Precedence(); ?></td>
<td for="section"><?php echo fill_AppointmentList($conn); ?></td>
<td for="section"><input name ="address1" id="address1" class="form-control ui-autocomplete-input" autocomplete="on" placeholder="Enter Stn Name"></td>
<td for="section"><?php echo fill_ModeOfDespatch(); ?></td>
</tr>
';
return ($tblRow);
请注意,我调用了HTML代码中的PHP函数用于填充自动完成,日期选择器,并选择对象。
的JS脚本添加到我的表中的这个<tr>
如下:
$('#addtblRow').click(function() {
var tblRowNew = <?php echo addRowtoTable()?> ;
$("table tbody").append(tblRowNew);
});
浏览器的错误消息的截图是这样
我能得到帮助解决这个错误。