-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathsimpleRestClient.html
More file actions
116 lines (103 loc) · 3.51 KB
/
Copy pathsimpleRestClient.html
File metadata and controls
116 lines (103 loc) · 3.51 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!--
Copyright 2012 The Infinit.e Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Simple REST Client</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="lib/settings.js"></script>
<link href="lib/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="lib/base.css" rel="stylesheet">
<link href="lib/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript" src="lib/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="lib/bootstrap/js/jquery-latest.js"></script>
</head>
<body>
<div class="container">
<div class="main-div">
<table width="100%" cellspacing="0" cellpadding="8" >
<tr bgcolor="#000000">
<td>
<h4 style="color:#ffffff">Visualizing MongoDB Objects in Concept and Practice Sample Code</h4>
</td>
</tr>
<tr>
<td align="center">
<table cellspacing="2" cellpadding="3" width="100%">
<tr style="border-bottom-width: 1px; border-bottom-style:dotted; border-bottom-color:#DADADA;">
<td bgcolor="#FFFFDB" width="50%"><h4>Simple JQuery Based Rest Client</h4></td>
</tr>
<tr>
<td>
<table width="100%" cellspacing="1" cellpadding="3">
<tr valign="top">
<td width="15%"><strong>Query URL:</strong></td>
<td width="85%">
<table cellpadding="3">
<tr valign="top">
<td><input type="text" style="width: 550px;" id="queryUrl"
value="http://127.0.0.1/ikanow.mongodc2013.presentation/json/USDC_25_Records.json"></td>
<td><button class="btn" id="runQuery">Query</button></td>
</tr>
</table>
</td>
</tr>
<tr valign="top">
<td width="15%"><strong>JSON Result:</strong></td>
<td width="85%">
<textarea id="queryResult" name="queryResult" style="width: 650px;" rows="15"></textarea>
</td>
</tr>
<tr>
<td width="15%"> </td>
<td width="85%"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
<!---------- JavaScript/JQuery Code ---------->
<script>
$(document).ready(function () {
$("#runQuery").click(function() { runQuery(); });
});
function runQuery()
{
var queryUrl = $('#queryUrl').val();
if (queryUrl.length > 0) {
$.ajax({
type: 'GET',
url: queryUrl,
async: true,
contentType: "application/json",
dataType: 'json',
success: function(msg) {
$("textarea#queryResult").val(JSON.stringify( msg, null, '\t' ));
}
});
}
}
</script>