如何通过使用ajax动态附加表单字段值来检索查询结果?
<script>
$(document).ready(function() {
$("textbox").autocomplete({
source: function(query, response) {
$.ajax({
url: "/xxx/sample.cfc?method=queries&returnformat=json",
dataType: "json",
data: {
searchKeyword: query.term
},
success: function(result) {
response(result);
}
});
}
});
});
</script>
我已经尝试了下面的代码,但无法获得输出。这种方式正确吗?
如何通过传递searchKeyword
给 sample.cfc 来获取记录?sample.cfc 中要写的逻辑是什么?