SPServices CORS problem

May 19, 2014 at 4:02 PM
Edited May 19, 2014 at 4:05 PM
Hello,

I need to access from a different domaine on a mobile a SharePoint list. Here is my code, a simple get request :
    $(document).ready(function() {
      jQuery.support.cors = true;
      $.support.cors = true;

      $().SPServices({
          operation: "GetListItems",
          webURL: "http://teamspace.test.slb.com/sites/EMSProjectManagementForumParis2014/",
          listName: "PM-Registration",
          CAMLQuery: '<Query></Query>',
          error: function (xhr, message, error) {
                alert('error : ' + error);
          },
          completefunc: function (xData, status) {
              alert('Status: '+status+' xdata: ' + xData.statusText);
              alert('RESPONSE: ' + xData.responseText);

              // $(xData.responseXML).SPFilterNode("z:row").each(function() {
              //   var liHtml = "<li>" + $(this).attr("ows_Name") + "</li>";
              //   $("#tasksUL").append(liHtml);
              // });
          }
      });
    });
I use jquery-1.11.0.min.js and jquery.mobile-1.3.2.min.js.

The problem seems to be CORS blocking. I am saying that because it works perfectly with Chrome if I use the command : --args --disable-web-security.
I got the error on Chrome without disabling web security :

No 'Access-Control-Allow-Origin' header is present on the requested resource

I also test '$.support.cors = false' to see it works correctly and I got an error with 'No transport', so I guess it works.

Am I missing something ? I think it is a client side problem about CORS as it works with Chrome without web security.

Thanks !