Use JQuery to send a request to refresh the page locally

json

  • What is JSON

    JSON(JavaScript Object Notation) is a lightweight data exchange format. It is based on ECMAScript A subset of. JSON uses a completely language independent text format, but also uses habits similar to the C language family (including C,C++,C#,Java,JavaScript,Perl,Python Etc.). These features make JSON an ideal data exchange language. Easy to read and write, but also easy to machine analysis and generation (generally used to improve the network transmission rate).

  • JSON format

    JSON object

    { key1:value}   
    {"username":"zhangsan","password":"123"}
    

    JSON array

    [{ key1:value},{ key1:value},{ key1:value}]
    

Old yellow calendar case of programmer

Refer to the following link
http://www.liweicg.cn/

code implementation

1. Import file
css

body * {
	font-family:"Consolas","Microsoft Yahei", Arial, sans-serif;
}

body {
	background: white;
	margin: 0;
	padding: 0;
}

.container {
	width: 320px;
	margin: 0 auto 50px;
}

.container>.title {
	color: #bbb;
	font-weight: bold;
	margin-bottom: 10px;
	background: #555;
	padding: 5px 15px;
}

.split, .clear {
	clear: both;
	height: 1px;
	overflow-y: hidden;
}

.good, .bad {
	clear: both;
	position: relative;
}

.bad {
	/*top: -1px;*/
}

.good .title, .bad .title {
	float: left;
	width: 100px;
	font-weight: bold;
	text-align: center;
	font-size: 30pt;
	position:absolute;
	top:0;
	bottom:0;
}

.good .title>table, .bad .title>table {
	position:absolute;
	width:100%;
	height:100%;
	border:none;
}

.good .title {
	background: #ffee44;
}


.bad .title {
	background: #ff4444;
	color: #fff;
}

.good .content, .bad .content {
	margin-left: 115px;
	padding-right: 10px;
	padding-top: 1px;
	font-size:15pt;
}

.good {
	background: #ffffaa;
}

.bad {
	background: #ffddd3;
}

.content ul {
	list-style: none;
	margin:10px 0 0;
	padding:0;
}

.content ul li {
	line-height:150%;
	font-size: 15pt;
	font-weight: bold;
	color: #444;
}

.content ul li div.description {
	font-size: 11pt;
	font-weight: normal;
	color: #777;
	line-height: 110%;
	margin-bottom: 10px;
}


json.data

[
    {
        "name": "Write unit test",
        "good": "Writing unit tests will reduce errors",
        "bad": "Writing unit tests will reduce your development efficiency"
    },
    {
        "name": "Take a shower",
        "good": "You haven't bathed in days?",
        "bad": "Will wash away the design inspiration",
        "weekend": true
    },
    {
        "name": "Get some exercise",
        "good": "",
        "bad": "Less energy, more food",
        "weekend": true
    },
    {
        "name": "smoking",
        "good": "Smoking is good for refreshing and quick thinking",
        "bad": "It doesn't matter if you die early, unless you have enough to live",
        "weekend": true
    },
    {
        "name": "Go live during the day",
        "good": "It's safe to go online during the day",
        "bad": "Potentially catastrophic"
    },
    {
        "name": "Restructure",
        "good": "Code quality improved",
        "bad": "You're likely to get bogged down"
    },
    {
        "name": "Use%t",
        "good": "You look better",
        "bad": "People will think you're pretending"
    },
    {
        "name": "Job hopping",
        "good": "Let go when it's time to let go",
        "bad": "Given the current economic situation, your next job may not be better than it is now"
    },
    {
        "name": "recruit",
        "good": "You have the potential to be a great man",
        "bad": "Can this person write a program?"
    },
    {
        "name": "Interview",
        "good": "The interviewer is in a good mood today",
        "bad": "If the interviewer is upset, he will take it out on you"
    },
    {
        "name": "Submit resignation application",
        "good": "The company has found a guy who is more capable and cheaper than you. I wish you could get out of here",
        "bad": "Given the current economic situation, your next job may not be better than it is now"
    },
    {
        "name": "Apply for a raise",
        "good": "The boss is in a good mood today",
        "bad": "The company is considering layoffs"
    },
    {
        "name": "work overtime at night",
        "good": "Night is the best time for programmers",
        "bad": "",
        "weekend": true
    },
    {
        "name": "Brag in front of your sister",
        "good": "Improve your image of poverty",
        "bad": "Will be seen through",
        "weekend": true
    },
    {
        "name": "Rolling pipe",
        "good": "Avoid buffer overflow",
        "bad": "Forced to roll ashes and fly smoke",
        "weekend": true
    },
    {
        "name": "Browse adult website",
        "good": "Regain confidence in life",
        "bad": "You'll be upset",
        "weekend": true
    },
    {
        "name": "Named variable\"%v\"",
        "good": "",
        "bad": ""
    },
    {
        "name": "Write more than%l Method of line",
        "good": "Your code is well organized. It doesn't matter if it's a little longer",
        "bad": "Your code will be in such a mess that you can't understand it"
    },
    {
        "name": "Submission code",
        "good": "The odds of conflict are the lowest",
        "bad": "You encounter a lot of conflicts that make you feel like you're not going through time"
    },
    {
        "name": "Code Review ",
        "good": "The chance of finding important problems increases greatly",
        "bad": "You can't find anything. You're wasting your time"
    },
    {
        "name": "Attend a meeting",
        "good": "Take a nap after writing code",
        "bad": "Be careful of the black pot on the back of the quilt"
    },
    {
        "name": "hit DOTA",
        "good": "You will be as helpful as God",
        "bad": "You're going to be brutalized",
        "weekend": true
    },
    {
        "name": "Online at night",
        "good": "Night is the best time for programmers",
        "bad": "You're exhausted during the day"
    },
    {
        "name": "repair BUG",
        "good": "You're right today BUG Our sense of smell is greatly improved",
        "bad": "New BUG More than fixed"
    },
    {
        "name": "Design review",
        "good": "Design review meeting will become brainstorming",
        "bad": "Everyone's exhausted, and the judges are gone"
    },
    {
        "name": "Requirements review",
        "good": "",
        "bad": ""
    },
    {
        "name": "On Weibo",
        "good": "What happened today can't be missed",
        "bad": "Today's microblog is full of negative energy",
        "weekend": true
    },
    {
        "name": "upper AB station",
        "good": "Need a reason?",
        "bad": "Brother Manping, GUI Liang blinds you",
        "weekend": true
    },
    {
        "name": "play FlappyBird",
        "good": "There's a high chance of breaking the record today",
        "bad": "Unless you want to smash your cell phone",
        "weekend": true
    }
]

js

  1. html

Tags: Javascript JSON ECMAScript Java

Posted on Thu, 07 May 2020 11:34:17 -0400 by S_henry