var cookieOperate = { cookieNames: { companyCNName:"_companyCNName", companyENName:"_companyENName", status:"_ctatus", anywords:"_anywords", isExistingCustomers:"_isExistingCustomers", city:"_city", toDeliverGroupList:"_toDeliverGroupList", isDistribution:"_isDistribution", industry:"_industry", source:"_source", minConversionTime:"_minConversionTime", maxConversionTime:"_maxConversionTime", minDeliverTime:"_minDeliverTime", maxDeliverTime:"_maxDeliverTime", pageSize:"_pageSize", countries:"_countries", customersRequest:"_customersRequest" }, expireDays:1, set: function (cookieName, value) { var exdate = new Date(); exdate.setDate(exdate.getDate() + cookieOperate.expireDays); document.cookie = cookieName + "=" + escape(value) + ((cookieOperate.expireDays == null) ? "" : ";expires=" + exdate.toGMTString()); }, delete: function (cookieName) { setCookie(cookieName, "", -1); }, get: function (cookieName) { if (document.cookie.length > 0) { c_start = document.cookie.indexOf(cookieName + "="); if (c_start != -1) { c_start = c_start + cookieName.length + 1; c_end = document.cookie.indexOf(";", c_start); if (c_end == -1) { c_end = document.cookie.length; }; return unescape(document.cookie.substring(c_start, c_end)); }; }; return ""; } }
js保存cookie数据
cookieOperate.set(cookieOperate.cookieNames.companyCNName, postRequst.CompanyCNName);
js获取cookie数据
postRequst.CompanyCNName=cookieOperate.get(cookieOperate.cookieNames.companyCNName)