本文介绍了无法在jquery中设置和获取coockies的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正试图在jquery中设置并获取coockies但无法阅读。
var Objdata = {};
Objdata.username = username;
Objdata.password =密码;
var urls =gallries.aspx / CheckUser;
alert(用户名+密码);
$ .ajax({
类型:POST,
url:urls,
数据:{'用户名':'+用户名+','密码' :'+ password +'},
contentType:application / json; charset = utf-8,
dataType:json,
success:function(response){
if(response.d == true){
alert(username);
$ .cookie(loggedInUser,username);
alert($。 cookie(loggedInUser));
alert('登录成功');
_loginMsg.addClass(成功)。removeClass(error);
_loginMsg。 html(登录成功!);
$('。user_login')。animate({'top':' - 165px'},800);
$('#mod al')。fadeOut(500);
}
if if block Iam设置并试图进入下一步。 。
解决方案
I am trying to set and get coockies in jquery but cant read.
var Objdata = {}; Objdata.username = username; Objdata.password = password; var urls = "gallries.aspx/CheckUser"; alert(username + password); $.ajax({ type: "POST", url: urls, data: "{'username':'" + username + "','password':'" + password + "'}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (response) { if (response.d == true) { alert(username); $.cookie("loggedInUser", username); alert($.cookie("loggedInUser")); alert('Login Success'); _loginMsg.addClass("success").removeClass("error"); _loginMsg.html("Login was successful!"); $('.user_login').animate({ 'top': '-165px' }, 800); $('#modal').fadeOut(500); }
in if block Iam setting and trying to get in next step..
解决方案
这篇关于无法在jquery中设置和获取coockies的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!