I have gotten the shorten url from the long url which is https://www.jocom.my/. I would like to display the shorten url on current page with javascript when redirected. I have used the window.location.href but it only shows the long url. Can someone help me on this?
code:
$(document).ready(function() {
var moo = window.location.href;
$.ajax({
url: 'api.jocom.com.my/api/url?url=' + moo,
type: 'POST',
})
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
答案 0 :(得分:0)
我建议您主持自己的网址缩短服务。 试试https://github.com/azetrix/ShortLink 或者试试https://github.com/cydrobolt/polr