-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
83 lines (70 loc) · 1.89 KB
/
index.html
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<html>
<head>
<meta charset="UTF-8">
<title>Replace Me</title>
<style>
body {
font-size: 20px;
}
label, input {
display: block;
}
input,textarea {
padding: 15px;
margin-bottom: 20px;
}
button {
background-color: #48CFAD;
font-size: 25px;
color: white;
border: 1px solid #48CFAD;
border-radius: 5px;
}
.left {
width: 50%;
float: left;
border-right: 1px solid #ccc;
}
#replaced-text {
width: 45%;
float: right;
}
</style>
</head>
<body>
<div class="left">
<form action="/replace" method="POST">
<label for="template">Template</label>
<textarea name="template" id="template" cols="60" rows="20"></textarea>
<label for="client_name">Replace [] with</label>
<input type="text" name="client_name" id="client_name">
<label for="company_name">Replace {} with</label>
<input type="text" name="company_name" id="company_name">
<label for="your_name">Replace () with</label>
<input type="text" name="your_name" id="your_name">
</form>
<button id="submit-text">Replace</button>
</div>
<label for="result">Result</label>
<textarea id="replaced-text" name="result" cols="60" rows="20"></textarea>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
$('#submit-text').click(function(event) {
$.ajax({
url: '/replace',
type: 'POST',
dataType: 'json',
data: {
template: $('#template').val(),
client_name: $('#client_name').val(),
company_name: $('#company_name').val(),
your_name: $('#your_name').val()
},
success: function(result) {
$('#replaced-text').val(result.data);
},
});
});
</script>
</body>
</html>