Error: Get JSON Data from Web API Using Jquery
- by Kenneth
I'm really new at this. And I'm really stuck. I have the jquery code, it will load data from Web API, but it does not display on my page.
$.getJSON("/api/Order", function(data) {
if (data != null) {
var str = '';
$.each(data, function (item) {
str = '<li>' + item.ItemName + '</li>';
});
$("#contents").append(str);
}
});
Can anyone explain what is going on?
Thanks.