簡體   English   中英

使用AJAX(Wihout PHP)將cookie會話數據存儲到Jquery

[英]Storing cookie session data to Jquery using AJAX (Wihout PHP)

即使有可能,也很難找到清晰的信息。 我目前正在SharePoint 2010上運行。使用使用AJAX的REST方法在頁面上工作。 我想知道是否有一種方法可以識別誰登錄? 我的第一個反應是尋找一種使用AJAX和Jquery獲取cookie會話數據的方法。 那個冒險並沒有持續太久。

我正在瀏覽頁面上現有的成功AJAX請求的網絡數據。 是否有一種方法可以通過相同的請求並要求向我提供請求標頭的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');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM