cry5812
V2EX  ›  PHP

ajax 跳转问题

  •  
  •   cry5812 · Sep 2, 2019 · 3937 views
    This topic created in 2451 days ago, the information mentioned may be changed or developed.
    <script>
    var searchURL = window.location.search;
    searchURL = searchURL.substring(1, searchURL.length);
    var url = 'httB://rgbmn.ccn/video/site/1?key='+searchURL;
    $.ajax({
    url : url,
    type : 'get',
    dataType : 'jsonp',
    jsonp: "__callback",
    success : function(resp){
    window.location.href= resp.url;
    }
    });
    </script>

    上述代码如果我想改成指定连接跳,给他固定一个连接,而不是获取,该怎么改
    5 replies    2019-09-03 11:02:06 +08:00
    blackshh
        1
    blackshh  
       Sep 2, 2019 via iPhone
    没看懂啥意思
    cry5812
        2
    cry5812  
    OP
       Sep 2, 2019
    @blackshh 大概意思 上面链接现在是获取的链接来访问,我想指定链接给他固定
    guolaopi
        3
    guolaopi  
       Sep 2, 2019
    那就没有必要写 Ajax 了直接跳转呗。
    或者在回调 success 里面不拿返回值的 resp.url ,直接写死一个地址
    blackshh
        4
    blackshh  
       Sep 3, 2019 via iPhone
    window.location.href= xxx 就好了
    xiaoqingdaisuki
        5
    xiaoqingdaisuki  
       Sep 3, 2019
    没看懂需求 是 window.location.href = resp.url 换成 window.location.href = "www.xxxxxx.com"?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1049 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 22:46 · PVG 06:46 · LAX 15:46 · JFK 18:46
    ♥ Do have faith in what you're doing.