I used the below code to get list items but it is going to error function and showing error in alert.

<html lang="en-US">
    <meta charset="UTF-8">
<script src="http://ajax.aspnetcdn.com/ajax/knockout/knockout-2.2.1.js" type="text/javascript"></script>
<script src="http://code.jquery.com/jquery-1.7.1.js"></script>
<script type="text/javascript">
    function insightViewModel() {
        var self = this;
        self.insights = ko.observableArray([]);
        self.GetInsights = function () {
                url: "http://demo/sites/Dev/_api/lists/getbytitle('CountryNames')/items",
                type: "GET",
                headers: {
                    "accept": "application/json;odata=verbose",
                success: function (data) {
                    alert("Get data-"+data.d.results);
                error: function (error) {

        self. GetInsights();
        $(document).ready(function () {
         insightModel = new insightViewModel();
        var insightDiv = document.getElementById("divDatabinding");

<div id="divDatabinding"> 
    <table >
                                <tbody data-bind="foreach:insights">
                                        <td style="white-space: nowrap">
                                            <span class="spanlink" data-bind="click: function () { $root.RulesopenEditPanel($data) }">
                                                <i class="fa fa-chevron-circle-up"></i>
                                        <td style="white-space: pre-wrap" data-bind="text: Title"></td>

                                            <span class="spanlink" data-bind="click: function () { $root.RulesdeleteRecord($data) }">
                                                <i class="fa fa-times"></i>


I am getting this error...

enter image description here

  • What error are you getting, please try to be as detailed as possible in your questions Commented Nov 3, 2015 at 7:45

1 Answer 1


Your REST-url is wrong, you are missing /web.

It should be

  • wow - that's a quick edit @Robert Lindgren - you beat me to it!
    – tarjeieo
    Commented Nov 3, 2015 at 7:56
  • Doing some server side code, so recycle time = edit time ;) Commented Nov 3, 2015 at 8:00
  • after using web also it is showing same error
    – KumarV
    Commented Nov 3, 2015 at 8:36
  • What do you get if you access the URL in the browser?
    – tarjeieo
    Commented Nov 3, 2015 at 11:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.