title: "App Web is not deployed for this app's request url" when trying to use SharePoint 2013's REST server and CSOM
body: <p>to get SharePoint List dataI am having an issue accessing the REST server via the CSOM. I have tried this with both the CSOM and just using jQuery. Code examples and the associated errors below. Can anyone direct me to a working example or tell me what I am doing wrong?</p>
  
  <p>This code is part of a SharePoint Hosted App and the list is just a list in the root web. The user has permission to access the list and the app.</p>
  
  <p><strong>CSOM Example:</strong> 
  <strong><em>Yields:</em></strong> 
  Fail! : App Web is not deployed for this app's request url <a href="http://mySharePointRootWebURL.local" rel="nofollow">http://mySharePointRootWebURL.local</a>.</p>
  
  <pre><code>var data = new SP.RequestExecutor("http://mySharePointRootWebURL.local/");
  data.executeAsync({
      method: "GET",
      headers: { "Accept": "application/json;odata=verbose" },
      url: "http://mySharePointRootWebURL.local/_api/web/lists/getbytitle(\'MyLstName\')/items",
      success: function (data) { console.log('success!'); },
      error: function (p1,p2,errorMessage) { console.log('Fail! :' + errorMessage); }
      });
  </code></pre>
  
  <p>I can see that this example is not hitting the root web at all (from the app / app web).</p>
  
  <hr>
  
  <p><strong>jQuery Example</strong>
  <em><strong>Yields:</em></strong> 
  Resource interpreted as Script but transferred with MIME type text/plain: "<a href="http://mySharePointRootWebURL.local/_api/web/lists/getbytitle" rel="nofollow">http://mySharePointRootWebURL.local/_api/web/lists/getbytitle</a>(\'MyLstName\')/items&amp;…Query19104068602353800088_1379462071044&amp;alt=json-in-script&amp;_=1379462071045". jquery.js:9597
  Uncaught SyntaxError: Unexpected token &lt; items:1
  fail! : Error: jQuery19104068602353800088_1379462071044 was not called</p>
  
  <pre><code>$.ajax({ 
      url: "http://mySharePointRootWebURL.local/_api/web/lists/getbytitle(\'MyListName\')/items",
      type: "GET",
      beforeSend: function(xhr){
      xhr.setRequestHeader('Accept', 'application/json;odata=verbose'); },
      headers: {"Accept":"application/json;odata=verbose"},
      success: function(data){ console.log("success"); },
      error: function errHandler(p1,p2,errMessage){ console.log("fail! : " + errMessage); },
      dataType: 'jsonp',
      crossDomain: true,
      data: {
          alt: 'json-in-script'
      },
  });
  </code></pre>
  
  <p>This is working as far as accessing the REST server and returning data, the problem is that the headers are not being added at all (verified in Fiddler). Without the headers the data comes back in XML. If that's how it has to be I will work with it, I guess, but I'd prefer to get JSON.</p>