我进行ajax调用以从数据库中检索数据,并以JSON格式返回数据。我想设计一个“视图”来显示数据。我只是将数据粘贴到视图中,然后显示数据。有人可以帮我吗? 注意:图片是用于最小化查看CMS的地方,因为knockOutJS和我是这个技术的新手
![在此处输入图片说明] [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
&GT;