Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将2个URL合并为1个URL_Url_Hyperlink - Fatal编程技术网

将2个URL合并为1个URL

将2个URL合并为1个URL,url,hyperlink,Url,Hyperlink,我想把2个网址合并成1个可点击的链接。第一个链接是设置cookie的链接,第二个链接是查询 第一环节: 第二: 谢谢 Marc您不能“组合”这两个URL,但可以使用Javascript向这两个URL发出请求 不幸的是,由于URL位于另一个域上,您不能简单地发出AJAX请求。不过,您可以使用雅虎的YQL这样的web服务来为您实现这一点 这里解释了这种方法:(见公认答案)。 HTML: 不确定您是否可以作为标准链接这样做。可以将第一页重定向到第二页。 <a href="http://www.

我想把2个网址合并成1个可点击的链接。第一个链接是设置cookie的链接,第二个链接是查询

第一环节:

第二:

谢谢


Marc

您不能“组合”这两个URL,但可以使用Javascript向这两个URL发出请求

不幸的是,由于URL位于另一个域上,您不能简单地发出AJAX请求。不过,您可以使用雅虎的YQL这样的web服务来为您实现这一点

这里解释了这种方法:(见公认答案)。

HTML:


不确定您是否可以作为标准链接这样做。可以将第一页重定向到第二页。
<a href="http://www.homeaway.com/search/keywords:boston" class="my_link">Linky</a>
// User clicks your link:
$('.my_link').click(function(){

    // The link to fire silently before redirecting:
    var first_url = "http://www.homeaway.com/?CID=a_cj_7123410&utm_source=cj&utm_medium=affiliates&utm_content=7123410&utm_campaign=10938928";

    // YQL query:
    var yql_url = "http://query.yahooapis.com/v1/public/yql?"+
        "q=select%20*%20from%20html%20where%20url%3D%22"+
        encodeURIComponent(first_url)+
        "%22&format=xml'&callback=?";

    // Fetch YQL URL before returning true:
    return $.getJSON(yqlUrl2Use, function(data){
        return true; // Goto the homeaway.com address.
    });
});