Instantly share code, notes, and snippets.

What would you like to do?
string HTML_BODY =
"<!DOCTYPE html>
<meta charset='UTF-8'>
<script type='text/javascript' src=''></script>
<style type='text/css'>
body, input, button {
font-family: tahoma, arial, 'hiragino kaku gothic pro', meiryo, 'ms pgothic', sans-serif;
zoom: 200%;
$(function() {
$('button').click(function() {
var content = {};
content.text = $('#input').val(); = $(this).attr('id');
if (content.text != '') {
'type': 'POST',
'url': location.href,
'dataType': 'json',
'data': JSON.stringify(content)
}).done(function(data) {
<div id='output'>ajaxのサンプル</div>
<p><input id='input' style='width:100%;'></p>
<button id='btn1'>赤で表示</button>
<button id='btn2'>青で表示</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment