-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
66 lines (58 loc) · 1.67 KB
/
test.php
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
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1");
</script>
<script type="text/javascript" src="js/tiny_mce/tiny_mce_src.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced"
});
<!-- Blah testing -->
function ajaxLoad() {
var ed = tinyMCE.get('content');
// Do you ajax call here, window.setTimeout fakes ajax call
ed.setProgressState(1); // Show progress
$.ajax({
type: 'POST',
url: "util/notepadPost.php",
statusCode: {
404: function() {
alert('page not found');
},
409: function(jqXHR, textStatus, errorThrown) {
alert('409 woohoo ' + errorThrown);
},
200: function(data, textStatus, jqXHR) {
alert('200 ' + data);
}
},
data: {
//key1: "value1",
error : 'true'
},
complete: function(jqXHR, textStatus) {
ed.setProgressState(0);// Hide progress
}
});
}
function ajaxSave() {
var ed = tinyMCE.get('content');
// Do you ajax call here, window.setTimeout fakes ajax call
ed.setProgressState(1); // Show progress
window.setTimeout(function() {
ed.setProgressState(0); // Hide progress
alert(ed.getContent());
}, 3000);
}
</script>
<form method="post" action="">
<textarea name="content" style="width:100%">
</textarea>
<input type = 'button' onclick = 'ajaxSave(parameter)' value = 'save'/>
<input type = 'button' onclick = 'ajaxLoad()' value = 'load'/>
</form>
<form method="post" action="util/notepadPost.php">
<input type = 'text' name='successNOT' />
<input type = 'submit' name='success' value = 'submit'/>
</form>