javascript - 使用 AJAX 将 cookie session 数据存储到 Jquery(不使用 PHP)

标签 javascript jquery ajax rest sharepoint-2010

如果可能的话,很难找到明确的信息。我当前正在 Sharepoint 2010 上运行。使用使用 AJAX 的 REST 方法处理页面。我想知道是否有办法能够识别谁登录了?我的第一 react 是寻找一种使用 AJAX 和 Jquery 获取 cookies session 数据的方法。那次冒险并没有持续太久。

我正在扫描页面上现有成功 AJAX 请求的网络数据。有没有办法通过同样的请求并要求向我提供请求 header 的 cookie 数据?

loadActiveIncidents: function () {
        $.ajax({
            url: this.basePath() + '/PROD_Incidents?$filter=ÉtatValue%20ne%20%27Fermé%27&$orderby=PrioritéValue desc',
            dataType: 'json',
            cache: false,
            success: function (data) {

                $.each(data.d.results, function (index, incident) {

                $('#example tbody').append(
                "<tr>" +
                "<td class='over_flow_control'> <button class='edit_button btn btn-default btn-sm' name ='btnSubmit' type='button' value='Edit' data-ID='"+incident.ID+"'><i class='glyphicon glyphicon-edit'></i></button></td>" +
                "<td class='over_flow_control'>" + incident.Incident + "</td>" +
                "<td class='over_flow_control'><h4><span class='priorité_span'>" + incident.PrioritéValue + "</span></h4></td>" +
                "<td class='over_flow_control'>" + incident.Composante + "</td>" +
                "<td class='over_flow_control text-left'>" + incident.Description + "</td>" +
                "<td class='over_flow_control Date_de_début_cell'>" + incident.Date_de_début + "</td>" +
                "<td class='over_flow_control'>" + incident.ResponsableValue + "</td>" +
                "</tr>");   
                })
                IncidentManager.table_conditional_format();
                $('#loading').hide("slow");
                $('#example').show("slow");
            }
        });
    },

最佳答案

我想你可能会使用 https://github.com/carhartl/jquery-cookie

然后您可以执行以下操作: $.cookie('mycookie', 'mycookievalue');

删除: $.removeCookie('mycookie');

关于javascript - 使用 AJAX 将 cookie session 数据存储到 Jquery(不使用 PHP),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34080851/

相关文章:

django - Ajax ,Django : status 200 but throws error instead of success

Jquery Datepicker 显示当前日期

jquery - 使用 FormData 对象发送 ajax 调用时出现 SSL 错误

javascript - 我在 Wordpress 中加载更多帖子 Ajax 按钮不起作用

javascript - Ajax 无法用于登录检查

jquery - 如何在同位素中设置砌体水平布局

ajax - 处理 Web 服务故障的最佳实践

javascript - 带有选择器的 jQuery .remove() 不起作用

javascript - 在 ajax 请求后重新初始化 processing.js 草图

javascript - 模态窗口和对话窗口有什么区别?