var collListItem = null; function IsExsiteData() { collListItem = null; var peoplePickerData1 = getPeoplePickerDataDocument(); var userId1 = getXmlValue(peoplePickerData1, "/ArrayOfDictionaryEntry/DictionaryEntry[./Key = 'SPUserID']/Value"); var ActivityID1=$("#td_IDInfo").text(); var clientContext = new SP.ClientContext.get_current(); var web = clientContext.get_web(); var roleList = web.get_lists().getByTitle($("#div_LibName").text()); var camlQuery = new SP.CamlQuery(); var strCaml = "<View><ViewFields><FieldRef Name='ID'/></ViewFields><Query><Where><And><Eq><FieldRef Name='_x56e2__x961f__x6d3b52a8_ID' /><Value Type='Number'>"+ActivityID1 +"</Value></Eq><Eq><FieldRef Name='_x62a5_40d__x4eba_' LookupId='true' /><Value Type='User'>"+ userId1 +"</Value></Eq></And></Where></Query></View>"; camlQuery.set_viewXml(strCaml); collListItem = roleList.getItems(camlQuery); clientContext.load(collListItem); clientContext.executeQueryAsync( function (sender, args) { QuerySucceeded(sender, args); }, function (sender, args) { QueryFailed(sender, args); } ); } function QuerySucceeded(sender, args) { var listItemEnumerator = collListItem.getEnumerator(); var idStr=""; while(listItemEnumerator.moveNext()) { var myListItem = listItemEnumerator.get_current(); idStr=idStr+myListItem.get_item('ID')+","; } if(idStr=="") { EntryVoteData(); } else { alert("该用户!"); } } function QueryFailed(sender, args) { alert("提失败!"); }