-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
77 lines (55 loc) · 2.32 KB
/
index.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
67
68
69
70
71
72
73
74
75
76
77
<?php
/**
index.php
This file works as client of the API.
*/
?><!DOCTYPE html>
<html>
<head>
<title>JSON API Communicator Client</title>
<meta charset="UTF-8">
</head>
<body>
<h1>JSON API Communicator Client</h2>
<h2>Params</h2>
<form id="apiCaller" action="#" method="post">
Action: <select name="action">
<option value="sendMessage">Send Message</option>
<option value="listConversations">List Conversations</option>
<option value="viewConversation">View Conversation</option>
</select><br /><br />
User [email]: <input type="text" name="user" value="user" /><br /><br />
Title: <input type="text" name="title" value="title" /><br /><br />
Comment: <input type="text" name="comment" value="comment" /><br /><br />
Receipient [email]: <input type="text" name="receipient" value="receipient" /><br />
<br />
<button>Call API</button>
</form>
<h2>Answer</h2>
<textarea id="resultPlain" style="width: 100%" rows="5"></textarea>
<h2>readme.md</h2>
<p><?php echo nl2br( file_get_contents('readme.md') ); ?></p>
<script src="//code.jquery.com/jquery-2.2.0.min.js"></script>
<script type="text/javascript">
$(function() {
// on form submit
$('#apiCaller').submit(function (e) {
// cancel default action
e.preventDefault();
// call api and put the answer in textarea
$('#resultPlain').load(
'api.php',
{
action: $('select[name=action]').val(),
user: $('input[name=user]').val(),
title: $('input[name=title]').val(),
comment: $('input[name=comment]').val(),
receipient: $('input[name=receipient]').val()
}
);
return false;
});
});
</script>
</body>
</html>