1
Vote

Get SharePoint list items through a single html

description

I want to get a SharePoint list items from a none-SharePoint host html file. for example I saved this html file on my computer. if I open this single file use IE, yes, I can get all the items. But it's faild if through Chrome or other web browser. I am new on SharePoint, I will die:(

the error message are: " No 'Access-Control-Allow-Origin' header is present on the requested resource" etc.

below is my code:
$().SPServices({
      operation: 'Login',
      username: 'domain\\userid',
     password: 'password',
     webURL: 'site url',
     completefunc: function (xData, Status) {
     $().SPServices({
            operation: "GetListItems",
            webURL: 'site url',
            async: false,
            listName: "FruitsList",
            CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
           completefunc: function (xData, Status) {
                       $(xData.responseXML).SPFilterNode("z:row").each(function () {
                            var liHtml = "<li>" + $(this).attr("ows_Title") + "</li>";
                            $("#tasksUL").append(liHtml);
                        });
          }
    });
}

});

comments