我进行 ajax 调用以从数据库中检索数据,并以 JSON 格式返回数据。我想设计一个“视图”来显示数据。充其量,我只是将数据粘贴到视图中并显示数据。有人可以帮助我吗?
注意:该图像是用于最小查看正在使用 knockOutJS 的 CMS,我是这项技术的新手
![在此处输入图像描述][1]
到目前为止我的来源:
<script type="text/javascript">
$(function () {
$("#btnSearch").click(function () {
$.ajax({
url: "../ideapark/DesktopModules/ResourcesFilter/AjaxHandler.ashx/",
dataType: "json",
type: "POST",
data: {
'action': 'ResponseFilterSearch'
, 'Keyword': $('#txtbKeyword value').val()
, 'Skill': $("#ddlSkills option:selected").val()
,'Types' : $("#ddlTypes option:selected").val()
, 'Topics': $("#ddlTopics option:selected").val()
, 'SortBy' : $("#ddlSortBy option:selected").val()
},
success: function(data) {
for(var i = 0; i < data.length; i++)
{
//t ajax handler recollection of resources.
//U NEED TDESERIALIZE
//var resID = data.response[i].ID;
//var summary = data.response[i].Summary;
//var pageID = data.response[i].PageID;
//var name = data.response[i].Name;
//var createdOn = data.response[i].CreatedOn
//var Total = data.response[i].Total;
}
},
error: function(XMLHttpRequest, textStatus, errorThrown)
{
console.log(errorThrown);
console.log(XMLHttpRequest);
console.log(textStatus);
console.log(errorThrown);
}
});
});
});
</script>
HTML
<div class="resourcesResult">
<input type="hidden" name="dnn$ctr687$View$rp_resList$ctl00$hf_resID" id="dnn_ctr687_View_rp_resList_hf_resID_0" value="71">
<a href="http://ideapark.rtraction.com/WebsofWonder/IWonderWhereTheAnimalsGoInTheFall.aspx">I Wonder Where The Animals Go In The Fall</a>
<br>
Students begin to understand where the animals in their environment are going in the fall
<br>
<h6>
<a id="lnkBtnTags_0" href="">observing</a>
</h6>
<h6>
<a id="lnkBtnTags_1" href="">change</a>
</h6>
<h6>
<a id="lnkBtnTags_2" href="">animal</a>
</h6>
<h6>
<a id="lnkBtnTags_3" href="">fall</a>
</h6>
<h6>
<a id="lnkBtnTags_4" href="">autumn</a>
</h6>
<h6>
<a id="lnkBtnTags_5" href="">five senses</a>
</h6>
<h6>
<a id="lnkBtnTags_6" href="">winter</a>
</h6>
<h6>
<a id="lnkBtnTags_7" href="">hibernation</a>
</h6>
<h6>
<a id="lnkBtnTags_8" href="">migration</a>
</h6>
<h6>
<a id="lnkBtnTags_9" href="">adapt</a>
</h6>
<h6>
<a id="lnkBtnTags_10" href="">seasons</a>
</h6>
<input type="button" value="Share">
</div>
</div
>