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.
6 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jaimin ShethiyaPosted Oct 4, 2019, 2:27 AM
Jaimin ShethiyaPosted Oct 4, 2019, 2:49 AM
Right then can you check when you have set the value on textbox that is set the proper value or undefined.
Sourabh DhimanPosted Oct 4, 2019, 2:43 AM
Jaimin ShethiyaPosted Oct 4, 2019, 2:36 AM
can you check this one
you have define a again cvalue to var and assign a textbox value maybe that is causes to store a data in cookie.
Sourabh DhimanPosted Oct 4, 2019, 2:36 AM
Sourabh DhimanPosted Oct 4, 2019, 2:33 AM