Php 通过jQuery Ajax函数发送localStorage变量,而不在url中

Php 通过jQuery Ajax函数发送localStorage变量,而不在url中,php,jquery,html,ajax,local-storage,Php,Jquery,Html,Ajax,Local Storage,你好 我只想知道是否有一种方法可以通过Ajax函数发送localStorage变量,而不必将其放在url中。例如: $.ajax({ type: "POST", url: "../pages/profile.php", data: localStorage.email, dataType: 'json' success: function(result) { //document.location.replace('../

你好

我只想知道是否有一种方法可以通过Ajax函数发送localStorage变量,而不必将其放在url中。例如:

$.ajax({
    type: "POST",
    url: "../pages/profile.php",
    data: localStorage.email,
    dataType: 'json'
    success: function(result)
    {     
        //document.location.replace('../pages/main.php');
    },
    error: function()
    {
        alert('An Error has occured, please try again.');
    }
});
在本例中,根据需要,php的返回类型将是JSON

提前感谢

更改

data: localStorage.email,

因此,
数据
采用正确的JSON格式,并使用(我相信)正确的方法从
本地存储
检索项目

data: {email: localStorage.getItem('email')}