【发布时间】:2012-01-24 16:57:54
【问题描述】:
我有以下代码从 db 中检索部门名称我在格式化背景和字体颜色等数据的 CSS 时遇到问题
<script type="text/jscript">
$(document).ready(function() {
$.ajax({
type: "POST",
url: "/AjaxLoad.asmx/GetBrands",
dataType: "json",
data: "{}",
contentType: "application/json; charset=utf-8",
success: function(data) {
var datafromServer = data.d.split(":");
$("[id$='tbBrands']").autocomplete({
source: datafromServer
});
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
}
</script>
<div id="ajaxbrands">
<input id="tbBrands" runat="server" />
</div>
知道如何向每个列表项添加文本,例如 <p > 或 <div>?
【问题讨论】:
-
您是否查看了the .jQuery example 以了解如何执行此操作?您只需在服务器 (PHP) 响应中返回您想要的列表项。
标签: c# php jquery asp.net-ajax