"HTML5 로컬스토리지 딕셔너리 저장·인출"의 두 판 사이의 차이

(새 문서: ;HTML5 로컬스토리지 딕셔너리 저장 ==예시== *예제: http://jmnote.com/html5/localStorage_dictionary.php ;localStorage_dictionary.php <source lang='html5'> <script> var...)
 
22번째 줄: 22번째 줄:
==같이 보기==
==같이 보기==
*[[HTML5 로컬스토리지]]
*[[HTML5 로컬스토리지]]
*[[딕셔너리]]
==참고 자료==
*http://stackoverflow.com/questions/13743292/how-to-store-a-dictionary-object-in-javascript-localstorage


[[분류: HTML5]]
[[분류: HTML5]]

2015년 1월 15일 (목) 00:34 판

HTML5 로컬스토리지 딕셔너리 저장

1 예시

localStorage_dictionary.php
<script>
var my_dictionary = {'foo':'hello', 'bar':'world'};
localStorage.my_dictionary = JSON.stringify(my_dictionary);
</script>
<a href='localStorage_dictionary2.php'>페이지 이동</a>
localStorage_dictionary2.php
<script>
var dictionary = localStorage.my_dictionary;
console.log(dictionary);
// {"foo":"hello","bar":"world"}
</script>

2 같이 보기

3 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}