일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- swift 화면전환
- 썸머노트
- 업비트
- MS-SQL
- CSV
- chart.js
- MYSQL
- 보유중스킨
- Banker's rounding
- Request.Form
- merge match
- update / insert
- 한글깨짐
- Oracle
- Android
- MSSQL
- 나만의 상점
- .csv
- Kakao API Address
- LEFT JOIN
- python
- Banker's
- Aspose.cells
- Excel
- 한번에 업데이트 인서트 하기
- rounding
- 일본여행
- league of legends
- upbit
- 초딩수학
Archives
- Today
- Total
DBA
View 단에서 Cookie값 읽어오기. - jquery.cookie.js 본문
728x90
반응형
SMALL
1. 일단 Layout 파일의 head tag 사이에 .js 파일을 참조 합니다. (단일 페이지로 작업 한다면 그 페이지에 넣어주면 됨)
<head><script src="~/js/jquery.cookie.js"></script></head>
2. 아래 함수를 넣고 사용 하면 됩니다.
function findCookieValue(jsCookieName, jsCookieItemName) {
var start = $.cookie(jsCookieName).indexOf(jsCookieItemName);
var jsCookieItemValue = '';
if (start != -1) {
start += jsCookieItemName.length;
var end = $.cookie(jsCookieName).indexOf('&', start);
if (end == -1) end = $.cookie(jsCookieName).length;
jsCookieItemValue = $.cookie(jsCookieName).substring(start + 1, end);
}
return jsCookieItemValue;
}
3. 사용 예시
var jsCookieItemValue = findCookieValue('Cookie', '사용자명');
$("#div사용자명").html("이름: " + jsCookieItemValue);
728x90
반응형
LIST
Comments