JSFiddle - React, Tailwind, and code Playground

by bschafer

HTML

<script src="https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js"></script>
<input id="cookie_this"></input>
<button id="btn_set_cookie">set</button>
<button id="btn_get_cookie">get</button>

CSS

body {
margin: 5px;                    
}

JavaScript

$.cookie.json = true;

// Messin' with Cookies
$("#btn_set_cookie").click(function() {
    $.cookie('the_cookie', jsondata);
    alert("cookie set!");
});

$("#btn_get_cookie").click(function() {
    var c = $.cookie('the_cookie');
    alert(c.Address.City);
});

var jsondata = {
  "Name": "John Smith",
  "Age": 33,
  "Employed": true,
  "Address": {
    "Street": "701 First Ave.",
    "City": "Sunnyvale, CA 95125",
    "Country": "United States"
  },
  "Children": [
    {
      "Name": "Richard",
      "Age": 7
    },
    {
      "Name": "Susan",
      "Age": 4
    },
    {
      "Name": "James",
      "Age": 3
    }
  ]
}