Javascript를 통해 검색되는 "cardID"값을 기반으로 SharePoint 2007 목록에서 CAML 쿼리를 사용하여 항목을 찾으려고합니다. 값이 변수에 할당되는 것을 볼 수 있지만 쿼리를 추가 할 때마다 목록이 더 이상 표시되지 않습니다. 더 많은 경험을 가진 사람이 내가 잘못하고있는 것을 정리할 수 있기를 바랍니다.CAML 쿼리가 작동하지 않음 - 스텀프가 됨
참고 :이 쿼리를 생성하기 위해 u2u CAML 도구를 사용했습니다. 거기에서 실행하면 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>
또한 "cardID"를 목록에있는 미리 정의 된 값으로 바꾸려고했습니다. 아직 결과가 반환되지 않습니다. :(
덕분에 raina77ow – snapplex