Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何获取登录到当前会话的用户的ID?_Javascript_Jquery_Jquery Mobile_Sugarcrm - Fatal编程技术网

Javascript 如何获取登录到当前会话的用户的ID?

Javascript 如何获取登录到当前会话的用户的ID?,javascript,jquery,jquery-mobile,sugarcrm,Javascript,Jquery,Jquery Mobile,Sugarcrm,我需要找到登录到当前会话的用户。我尝试了以下方法,但无效: 有人能帮我吗?提前谢谢! 据我所知,您应该寻找的是会话中的sugar crm项目,您是否请求该项目?您正在进行的其余通话需要您拥有会话令牌。通常,我们会在我们的CRM上设置一个REST用户,该用户可以通过REST访问。我尝试了以下方法,效果很好。 以下是我在这方面的发现: $.get(CurrentServerAddress + '/service/v4/rest.php', { method: "get_user_id",

我需要找到登录到当前会话的用户。我尝试了以下方法,但无效: 有人能帮我吗?提前谢谢!


据我所知,您应该寻找的是会话中的sugar crm项目,您是否请求该项目?

您正在进行的其余通话需要您拥有会话令牌。通常,我们会在我们的CRM上设置一个REST用户,该用户可以通过REST访问。

我尝试了以下方法,效果很好。


以下是我在这方面的发现:
$.get(CurrentServerAddress + '/service/v4/rest.php', {
    method: "get_user_id",
    input_type: "JSON",
    response_type: "JSON",
    rest_data:'"new_get_user_id":["session":"' + SugarSessionId + '"]'
}, function(data) {
    if (data !== undefined) {
        var userID = jQuery.parseJSON(data);
    }
});
'authenticated_user_id'
var userID = '';
    $.get(CurrentServerAddress + '/service/v4/rest.php', {
        method: "get_user_id",
        input_type: "JSON",
        response_type: "JSON",
        rest_data: '[{"session":"' + SugarSessionId + '"}]'
    }, function(data) {
        if (data !== undefined) {
            userID = jQuery.parseJSON(data);
        }
    });