-
Notifications
You must be signed in to change notification settings - Fork 0
/
getjson.html
35 lines (34 loc) · 1.74 KB
/
getjson.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
<!doctype html>
<head>
<title>get JSON</title>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
/* $("#btn1").click(function(){
$('#test').load('https://api.mytokenapi.com/currency/kline?com_id=btc_usdt&symbol=BTC&anchor=USDT&time=1674131400&market_id=338&period=1d×tamp=1674563179244&code=46a9a5a97745be5f4aeac7be830f56aa&platform=web_pc&v=1.0.0&language=en_US&legal_currency=USD');
}) */
/* $.getJSON("https://api.mytokenapi.com/currency/kline?com_id=btc_usdt&symbol=BTC&anchor=USDT&time=1674131400&market_id=338&period=1d×tamp=1674563179244&code=46a9a5a97745be5f4aeac7be830f56aa&platform=web_pc&v=1.0.0&language=en_US&legal_currency=USD", function (data) {
$.each(data.success, function (i, item) {
$("body").append('<h1>' + item.title + '</h1>');
});
}); */
$.ajax({
url: 'https://api.mytokenapi.com/currency/kline?com_id=btc_usdt&symbol=BTC&anchor=USDT&time=1674131400&market_id=338&period=1d×tamp=1674563179244&code=46a9a5a97745be5f4aeac7be830f56aa&platform=web_pc&v=1.0.0&language=en_US&legal_currency=USD',
dataType: "jsonp",
// data: "offset=0&num_items=10",
// username: 'username',
// password: 'password',
success: function (data) {
$.each(data.success, function (i, item) {
$("body").append('<h1>' + item.title + '</h1>');
});
}
});
});
</script>
</head>
<body>
<h3 id="test">请点击下面的按钮,通过 jQuery AJAX 改变这段文本。</h3>
<button id="btn1" type="button">获得外部的内容</button>
</body>
</html>