Hi guys i have a project that follows the 3 tier architecture, in my web application that uses mvc 4 i am trying to use knockout binding, but however my data is retrieve from my data tier but the UI is not been updated. Below are my code snippet
My Model that reside in my data tier which is a separate class library
public int SocialProfileId { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string Url { get; set; }
public string ImgUrl { get; set; }
My View model in my web project var SocialViewModel = function () { var self = this;
self.Title = ko.observable("");
self.SocialLinks = ko.observableArray();
GetSocialLinks();
function GetSocialLinks() {
$.ajax({
type: "GET",
url: "Ville/SocialLnk",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
self.SocialLinks(data);
alert(data[0]);
},
error: function (error) {
alert(er.status + "<--and-->" + erro.statusText);
}
});
}
}
My view showing my binding
<ul class="bl-socialLink" data-bind="foreach: SocialLinks">
<li>
<p data-bind="text: Title"></p>
<a data-bind="attr: { title: Title, href: Url}" target="_blank">
<img data-bind="attr: { alt: Title, src: ImgUrl }" />
</a>
</li>
How do i make my UI display the information? Because i cant figure out why my view is not displaying the values. Thanks