TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sourabh Dhiman
NA
323
58.3k
Cookie in jquery ?
Oct 4 2019 2:21 AM
function setCookie(cname, cvalue, exdays) {
debugger;
var d = new Date();
var cname = "ID";
var cvalue =$("#transactionID").val();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires = "expires=" + d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
I will here set cookies value . into cvalue variable.
$(document).ready(function () {
console.log("doc ready common js");
$.ajax({
type: "GET",
url: appurl + "common/Intialize",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
// Assigned Returned data to Global variable
$("#transactionID").val(data);
var cvalue;
setCookie("ID", cvalue, 1);
I want to get this function in this function but here face a problem = cavlue undefine .
I want to save cookie value then run this method. Please help me.
Reply
Answers (
6
)
Not Run Jquery Method ?
how to add current date + one month using jquery