Site Notice
hello, world
Difference between revisions of "Short url"
From Project-EPB Commons
([InPageEdit] 没有编辑摘要) |
([InPageEdit] 没有编辑摘要) |
||
Line 9: | Line 9: | ||
$.ajax({ | $.ajax({ | ||
url: 'https://common.wjghj.cn/api.php', | url: 'https://common.wjghj.cn/api.php', | ||
+ | type: 'post', | ||
+ | dataType: 'jsonp', | ||
data: { | data: { | ||
action: 'shortenurl', | action: 'shortenurl', | ||
url: $('#request').val() | url: $('#request').val() | ||
}, | }, | ||
− | |||
− | |||
success: function(data) { | success: function(data) { | ||
$('#url').html(data.shortenurl.shorturl); | $('#url').html(data.shortenurl.shorturl); |
Revision as of 03:18, 22 November 2019
<html>
<pre id="url"></pre> <input placeholder="https://wjghj.cn" value="https://wjghj.cn" id="request"></input><br/> <button onclick="start()">生成</button>
<script> function start() {
$.ajax({ url: 'https://common.wjghj.cn/api.php', type: 'post', dataType: 'jsonp', data: { action: 'shortenurl', url: $('#request').val() }, success: function(data) { $('#url').html(data.shortenurl.shorturl); } });
} </script> </html>