V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
cry5812
V2EX  ›  PHP

ajax 跳转问题

  •  
  •   cry5812 · 2019-09-02 19:20:57 +08:00 · 3099 次点击
    这是一个创建于 1668 天前的主题,其中的信息可能已经有所发展或是发生改变。
    <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 条回复    2019-09-03 11:02:06 +08:00
    blackshh
        1
    blackshh  
       2019-09-02 22:33:46 +08:00 via iPhone
    没看懂啥意思
    cry5812
        2
    cry5812  
    OP
       2019-09-02 22:41:56 +08:00
    @blackshh 大概意思 上面链接现在是获取的链接来访问,我想指定链接给他固定
    guolaopi
        3
    guolaopi  
       2019-09-02 23:26:54 +08:00
    那就没有必要写 Ajax 了直接跳转呗。
    或者在回调 success 里面不拿返回值的 resp.url ,直接写死一个地址
    blackshh
        4
    blackshh  
       2019-09-03 06:07:07 +08:00 via iPhone
    window.location.href= xxx 就好了
    xiaoqingdaisuki
        5
    xiaoqingdaisuki  
       2019-09-03 11:02:06 +08:00
    没看懂需求 是 window.location.href = resp.url 换成 window.location.href = "www.xxxxxx.com"?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4022 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 10:19 · PVG 18:19 · LAX 03:19 · JFK 06:19
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.