123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Jump</title>
- <!--<script src="http://code.jquery.com/jquery-2.2.4.min.js"></script>
- <script>
- $(function () {
- var search = window.location.search.replace('?', '');
- var params = search.split("&");
- var id = "";
- var type = "";
- var channel_id = "";
- $.each(params, function (index, item) {
- var param = item.split('=');
- if (param[0] == 't') {
- id = param[1]
- }
- if(param[0] == 'type'){
- type = 'code'
- }
- if(param[0] == 'channel_id'){
- channel_id = param[1]
- }
- });
- //var url = "/api/referral/getreferralshort?id=" + id + "&type=" + type;
- var url = "/api/referral/getreferralshort";
- $.ajax({
- url: url,
- type: "POST",
- data:{
- 'id':id,
- 'type':type
- },
- success: function (data) {
- var url = data.data.url;
- if (url) {
- window.location.href = url;
- } else {
- alert('跳转链接为空');
- }
- }
- });
- })
- </script>-->
- <script>
- window.onload = function(){
- var search = window.location.search.replace('?', '');
- var params = search.split("&");
- var id = "";
- var type = "";
- var channel_id = "";
- params.forEach(function(item, idx){
- var param = item.split('=');
- if (param[0] == 't') {
- id = param[1]
- }
- if(param[0] == 'type'){
- type = 'code'
- }
- if(param[0] == 'channel_id'){
- channel_id = param[1]
- }
- });
- var url_post = "/api/referral/getreferralshort";
- doPost(url_post, id, type);
- }
- function doPost(url, id, type)
- {
- var xmlhttp;
- if (window.XMLHttpRequest)
- {
- // IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
- xmlhttp=new XMLHttpRequest();
- }
- else
- {
- // IE6, IE5 浏览器执行代码
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange=function()
- {
- if (xmlhttp.readyState==4 && xmlhttp.status==200)
- {
- var jsonData = JSON.parse(xmlhttp.responseText);
- var url = jsonData.data.url;
- if (url) {
- window.location.href = url;
- } else {
- alert('跳转链接为空');
- }
- }
- }
- xmlhttp.open("POST", url, true);
- xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- xmlhttp.send("id=" + id + "&type=" + type);
- }
- </script>
- </head>
- </html>
|