I am unable to retrieve objects using the ClientContext.ExecuteQueryAsync method. Originally I was attempting to obtain a list item, but figured out that wasn't happening because I didn't really have a SPList. And that I didn't have a list because I didn't have a SPWeb. So I've simplified the code to do one thing: get a web. The results are the same in each case: no return from the asynchronous query. Nothing. It just disappears into the ether.
Here is the code, which is pretty much the standard routine I've found everywhere:
function getSelectedItems(
{
alert('executing getSelectedItems');
var clientContext = new SP.ClientContext.get_current();
var spweb = clientContext.get_web();
alert('Web id: ' + spweb.get_id());
clientContext.load(spweb);
clientContext.executeQueryAsync(
Function.createDelegate(this,this.onWebQuerySucceeded),
Function.createDelegate(this, this.onWebQueryFailed));
}
function onWebQuerySucceeded()
{
alert('Query succeeded');
}
function onWebQueryFailed(sender, args)
{
alert('Query failed');
}
ExecuteOrDelayUntilScriptLoaded(getSelectedItems, 'sp.js');
I am getting the current web: the alert does display an id. But neither the onWebQuerySucceeded function nor the onWebQueryFailed function function ever get invoked. I ran a web trace using Fiddler and here are the three web requests the trace captures:
GET /pki/mscorp/crl/Microsoft%20Secure%20Server%20Authority(7).crl HTTP/1.1
Cache-Control: max-age = 900
Accept: */*
If-Modified-Since: Thu, 06 Jan 2011 18:47:54 GMT
If-None-Match: "4df22d3ad2adcb1:0"
User-Agent: Microsoft-CryptoAPI/6.1
Connection: Keep-Alive
Host: mscrl.microsoft.com
HTTP/1.1 304 Not Modified
Content-Type: application/pkix-crl
Age: 164
Date: Wed, 19 Jan 2011 18:15:40 GMT
Expires: Wed, 19 Jan 2011 18:27:56 GMT
Connection: keep-alive
------------------------------------------------------------------
GET /pki/mscorp/crl/Microsoft%20Secure%20Server%20Authority(5).crl HTTP/1.1
Cache-Control: max-age = 900
Accept: */*
If-Modified-Since: Thu, 06 Jan 2011 18:48:25 GMT
If-None-Match: "b409c4cd2adcb1:0"
User-Agent: Microsoft-CryptoAPI/6.1
Connection: Keep-Alive
Host: mscrl.microsoft.com
HTTP/1.1 304 Not Modified
Content-Type: application/pkix-crl
Age: 307
Date: Wed, 19 Jan 2011 18:15:40 GMT
Expires: Wed, 19 Jan 2011 18:25:33 GMT
Connection: keep-alive
------------------------------------------------------------------
GET /pki/mscorp/crl/mswww(5).crl HTTP/1.1
Cache-Control: max-age = 900
Accept: */*
If-Modified-Since: Fri, 17 Dec 2010 19:39:40 GMT
If-None-Match: "0662d25229ecb1:0"
User-Agent: Microsoft-CryptoAPI/6.1
Connection: Keep-Alive
Host: mscrl.microsoft.com
HTTP/1.1 304 Not Modified
Content-Type: application/pkix-crl
Age: 416
Date: Wed, 19 Jan 2011 18:15:40 GMT
Expires: Wed, 19 Jan 2011 18:23:44 GMT
Connection: keep-alive
------------------------------------------------------------------
I'm at a complete loss. I'm developing against a SharePoint 2010 Foundation instance. Any help would be appreciated.