- 我需要的cookie数据追加在URL中的jQuery。
AcmeExtension.Php
Public function get_hash_attend($event_id,$user_id)
{
echo $event_id;
echo "<pre>";
echo $user_id;
$key = '[email protected]#[email protected]#$jks*&@';
$encrypt=$user_id."-".$event_id;
$encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $encrypt, MCRYPT_MODE_ECB);
$xyz = (base64_encode($encrypted));
$xyz = urlencode($xyz);
$xyz = str_replace("%2F",")",$xyz);
$xyz = str_replace("%3F","_",$xyz);
$xyz = str_replace("%2B","(",$xyz);
$hash='http://'.DOMAIN_NAME.'/ticket_transaction/autosubmit_advance/'.$event_id.'/'.$user_id.'/'.$xyz.'?source=oneclickEmail';
return $hash;
//$decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $d, MCRYPT_MODE_ECB);
}
js代码
<script>
$(document).ready(function()
{
$("#attend").click(function() {
alert("attend .click() .");
$.ajax({
type:"POST",
url:"{{get_hash_attend(9,13530767)}}",
success: function(data)
{
alert(data);
$("#attend").text("Attending");
//alert(data);
}
});
});
});
</script>
问题IM面对
- 当我用URL:“{{get_hash_attend(9,13530767)}} “ 工作正常。
- 但如何获取cookie数据,因为用户保存在cookie中。
- 我有$数据[$ k]的[ 'EVENT_ID'〕中树枝
我需要:
我需要在功能从饼干取用户数据。
特定网址的ID。
你想读取jQuery中的cookie值吗? – 2014-12-09 12:45:50
我在浏览器中设置cookie如何获取cookie并在url中设置 – user2818060 2014-12-09 12:47:36
$ .cookie('cookie name')会为您提供cookie的价值,如果您使用@dtelaroli建议的插件进行回答。 – 2014-12-09 12:48:44