-
Notifications
You must be signed in to change notification settings - Fork 5
/
cros.html
53 lines (46 loc) · 1.67 KB
/
cros.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
<html>
<head>
<script type="text/javascript" src="./js/libs/jquery-latest.min.js"></script>
<!-- <script type="text/javascript" src="./js/libs/jquery.ajax-cross-origin.min.js"></script> -->
</head>
<body>
<select id="service">
<option value="https://ip.jsontest.com/">IP Address</option>
<option value="https://headers.jsontest.com/">HTTP Headers</option>
<option value="https://date.jsontest.com/">Date & Time</option>
<option value="https://echo.jsontest.com/key/value/one/two">Echo JSON</option>
<option value='https://validate.jsontest.com/?json={"key":"value"};'>Validate</option>
<option value="https://code.jsontest.com/">Arbitrary JS Code</option>
<option value="https://cookie.jsontest.com/">Cookie</option>
<option value="https://md5.jsontest.com/?text=[text%20to%20MD5]">MD5</option>
<option value="https://byr7m3hqxg.execute-api.us-east-1.amazonaws.com/qa/quadrant">QUADRANTS</option>
<option value="https://2fol67t42e.execute-api.us-east-1.amazonaws.com/qa/galaxy">GALAXIES</option>
</select><br/>
<input type="text" id="url" style="width: 400px">
<input type="button" id="btn" value="Get JSON">
<br/><br/>
<div id="test" />
<script type="text/javascript">
$(function() {
$( '#service' ).on( 'change', function(){
$( '#url' ).val( $( this ).val() );
});
$( '#url' ).val( $( '#service' ).val() );
$( '#btn' ).click(function(){
var url = $( '#url' ).val()
// $.ajax({
// url: url,
// success: function(data) {
// $( '#test' ).html(data);
// console.warn('get data', data)
// }
// });
$.ajax(url)
.done(function(data){
console.warn('get data', data);
})
});
});
</script>
</body>
</html>