使用AJAX(Wihout PHP)将cookie会话数据存储到Jquery [英] Storing cookie session data to Jquery using AJAX (Wihout PHP)

查看:117
本文介绍了使用AJAX(Wihout PHP)将cookie会话数据存储到Jquery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使有可能,也很难找到清晰的信息.我当前在SharePoint Server 2010上运行.使用使用AJAX的REST方法在页面上工作.我想知道是否有一种方法可以识别谁登录?我的第一个反应是寻找一种使用AJAX和Jquery获取cookie会话数据的方法.那个冒险并没有持续太久.

Having a tough time finding clear information if this is even possible. I am currently running on Sharepoint 2010. Working on a page using the REST method that uses AJAX. I was wondering if there's a way to be able to identify whos logged in? My first reaction was to look for a way to get the cookies session data using AJAX and Jquery. That Adventure didn't last too long.

我正在浏览页面上已有的现有AJAX成功请求的网络数据.是否有办法通过相同的请求来传送请求并要求向我提供请求标头的cookie数据?

I was scanning trough the network data of an existing sucessul AJAX request i have on my page. Would there be a way to piggy back trough this same request and ask to provide me the request header's cookie data?

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');

You can then do: $.cookie('mycookie', 'mycookievalue');

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

To delete: $.removeCookie('mycookie');

这篇关于使用AJAX(Wihout PHP)将cookie会话数据存储到Jquery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆