I'm trying to use a CAML query to find a item from a SharePoint 2007 List based on the "cardID" value that is being retrieved through Javascript. I can see that the value is being assigned to the variable but whenever I try to add the query the list no longer displays. I'm hoping someone with more experience can clear up what I'm doing wrong.
Note: I used the u2u CAML tool to generate this query. When I execute it from there it returns a valid result just not when I try to use it in conjunction with jQuery.
<script language = "javascript"> function GetAnnouncementData() { var soapPacket = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
<soapenv:Body> \
<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
<listName>eCards</listName> \
<View> \
<Query><Where>
<Eq>
<FieldRef Name='Title' />
<Value Type='Text'>116</Value>
</Eq></Where> </Query>
<ViewFields> \
<FieldRef Name='Title' /> \
<FieldRef Name='Greeting' /> \
<FieldRef Name='Message'/> \
<FieldRef Name='Card' /> \
</ViewFields> \ </View> \
</GetListItems> \
</soapenv:Body> \ </soapenv:Envelope>"; jQuery.ajax({ >url: "http://localhost/place/_vti_bin/lists.asmx", type: "POST", dataType: "xml", data: soapPacket, complete: processResult, contentType: "text/xml; charset=\"utf-8\"" }); } function processResult(xData, status) { jQuery(xData.responseXML).find("z\\:row").each(function() {
JSRequest.EnsureSetup(); var cardID = JSRequest.QueryString["cardID"];
$("<li>" + $(this).attr("ows_Title") + "</li>").appendTo("#AnnouncementData"); }); }
$(document).ready( function(){ GetAnnouncementData(); }); </script>
I've also tried replacing "cardID" with a predefined value that is in the list. Still no results are returned. :(