質問編集履歴
1
情報の追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -16,4 +16,45 @@
|
|
16
16
|
<input type="submit" value="コンパイルする" name="" class="btn_1 submit" >
|
17
17
|
<textarea name="info" class="win_1" readonly >
|
18
18
|
</form>
|
19
|
+
```
|
20
|
+
```html
|
21
|
+
<head>
|
22
|
+
<meta charset="UTF-8">
|
23
|
+
<title>test</title>
|
24
|
+
<script src="js/jquery-3.4.1.min.js"></script>
|
25
|
+
<script src="js/n_trans.js"></script>
|
26
|
+
<form name="DebugForm" action="test.php" method="post" id="AjaxForm">
|
27
|
+
<input type="submit" value="テストボタン" name="" class="btn_1 submit" >
|
28
|
+
<br>
|
29
|
+
<textarea name="source" rows="30" cols="150">
|
30
|
+
</textarea>
|
31
|
+
<script>
|
32
|
+
$('#AjaxForm').submit(function(event) {
|
33
|
+
event.preventDefault();
|
34
|
+
var $form = $(this);
|
35
|
+
var $button = $form.find('.submit');
|
36
|
+
$.ajax({
|
37
|
+
url: $form.attr('action'),
|
38
|
+
type: $form.attr('method'),
|
39
|
+
data: $form.serialize(),
|
40
|
+
timeout: 10000,
|
41
|
+
beforeSend: function(xhr, settings) {
|
42
|
+
$button.attr('disabled', true);
|
43
|
+
},
|
44
|
+
complete: function(xhr, textStatus) {
|
45
|
+
$button.attr('disabled', false);
|
46
|
+
},
|
47
|
+
success: function(result, textStatus, xhr) {
|
48
|
+
$form[0].reset();
|
49
|
+
$("#result").append(result);
|
50
|
+
},
|
51
|
+
error: function(xhr, textStatus, error) {
|
52
|
+
alert('NG...');
|
53
|
+
}
|
54
|
+
});
|
55
|
+
// …
|
56
|
+
})(jQuery);
|
57
|
+
</script>
|
58
|
+
</body>
|
59
|
+
</html>
|
19
60
|
```
|