<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
function HandleError(error){
alert(error);
}
function SetTitle(){
var userid= _spPageContextInfo.userId;
var requestUri= "/sites/xxx/_api/web/lists/GetByTitle('xxx')/items?$filter=_x4f1a__x5458__x6863__x6848__x4e/Id eq "+userid;
var requestHeaders = { "accept" : "application/json;odata=verbose" };
$.ajax({
url : requestUri,
contentType : "application/json;odata=verbose",
headers : requestHeaders,
success : onSuccess,
error : HandleError
});
function onSuccess(data, request){
if(data.d.results.length>0){
jQuery("[title='xxx']").val(data.d.results[0].Title);
}
}
}
REST最好用的工具应该是那个JAVA RESTClient,但对于https开头的网站,我还没有配置好。。