N00b警报;我知道自己很危险,所以请原谅我的无知......我在这里和其他地方都经历了所有相关的问题,但我似乎无法理解答案中肯定包含的答案:-(加载时以HTML格式显示数据
我正在发布一个记录ID到一个页面,我想要一个表格来显示相关记录的内容我正在用HEAD部分中的这个脚本正确地获取记录(使用警报确认)(jquery 1.9被称为井):
<script type="text/javascript">
function getSelectedCustomer() {
...use the id to get the right record...
databaseAPI.callback = function() {
if (databaseAPI.error) {
alert("Database Error: " + databaseAPI.error);
}
else {
var customerRecord = databaseAPI.result;
alert("Test Callback: " + new String(customerRecord.full_name));
$("#quoteForm").load(customerRecord);
}
return;
};
databaseAPI.ajaxGet();
}
window.onload = getSelectedCustomer;
</script>
...并且要加载在体内的形式:
<form method="post" id="quoteForm" action="process_quote.php">
<table>
<tbody>
<tr>
<td>Name</td>
<td><input type="text" value="<?php $customerRecord['full_name']; ?>" name="full_name"></td>
</tr>
...other bits of the form...
<tr>
<td>
<input type="submit" value="Submit">
</td>
</tr>
</tbody>
</table>
</form>
我知道我错误地将各种东西放在一起。有人能让我理清该怎么办?
Michael的答案解决了表单中的INPUT字段。没有提到我不得不选择字段,以及:
<select size="0" name="email_sent">
<option value="No">No</option>
<option value="Yes">Yes</option>
</select>
更改输入以选择的作品。
'new String(customerRecord.full_name)'在alert中显示的是什么? – Dawson 2013-04-03 20:29:51
它显示记录中包含的正确名称值。迈克尔的回答做到了这一招,但现在我坚持如何加载选择字段(输入字段完美工作)。 – user2033578 2013-04-03 21:08:58