Hi All,
Please can any one help on below scenario. I have to create custom list of quick links and display in a page. In the quick link user can able to sort the order .Here is my code but not able to see the result in a page. Kindly help me.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type ="text/javascript">
var Arttitle;
var ArtLink;
var siteUrl = _spPageContextInfo.siteAbsoluteUrl;
jQuery(document).ready(function() {
//debugger;
jQuery.ajax({
url: siteUrl+"/_api/web/lists/GetByTitle('QuickLinks')/items?$select=Title,Link,Flag,SortOrder,Status&$orderby= SortOrder asc ",
type: "GET",
headers: { "Accept": "application/json;odata=verbose" },
success: function (data) {
var trhtml= "";
var InnerHTML_Value= '';
jQuery.each(data.d.results, function (index, value) {
Arttitle = value.Title;
ArtLink = value.Link;
AFlag = value.Flag;
AStatus = value.Status;
var cls;
if (AStatus == "Active")
{
if (AFlag == "Yes")
{
cls = "_blank";
}
else
{
cls = "_self";
}
trhtml = trhtml + "<li>" +"<a href='" +ArtLink + "' target= '" + cls +"'><span class='fa fa-arrow-circle-right'></span>"+ Arttitle + "</a></li>";
}
});
$(".quick_links").html(trhtml);
},
error: function (data) {
//output error HERE
alert(data.statusText);
}
});
});
function onSuccess(data, request){
console.log(trhtml);
$(".quick_links").append('trhtml');
}
function onError(error) {
alert(error);
}
</script>
</head>
<div class="margin_btm_50">
<h2>Quick Links</h2>
<ul class="quick_links">
</ul>
</div>
</html>