2017-02-07 26 views
0

我正在模式彈出窗口中,用戶可以填寫表單或跳過表單並繼續到外部URL。Bootstrap模式和使用外部URL

enter image description here

這是打開的模態代碼:

<a class="btn btn-info btn-lg open-AddBookDialog" data-toggle="modal" data-target="#myModal" data-remote="http//:www.google.co.uk">Open Modal</a>

$(document).on("click", ".open-AddBookDialog", function() { 
      var partner_url = $(this).data('remote'); 
      $('#skip').attr('href', partner_url); 
      alert(partner_url); 
     }); 

這裏的代碼附加到打開的模式按鈕,這個腳本拉從data-remote一個網址並將其設置爲我模式中按鈕的href。

然後將此URL提供給您可以在右側看到的按鈕(只要帶我...)。

在這個例子中,我使用了:http//:www.google.co.uk,但在模式中它的行爲很奇怪,我最終使用絕對路徑www.mysite.com/http;//www.google.co.uk

我也在提交表單後使用相同的URL。

我的問題是,爲什麼在這個設置中,模式不尊重所使用的鏈接是絕對鏈接到外部URL的事實?

+2

我認爲這是因爲'http //:www.google.co.uk'應該是'http:// www.google.co.uk' –

+0

或者可能是它需要'http :// www.google.co.uk'而不是'http; // www.google.co.uk' –

+0

@SGSVenkatesh>'本地鏈接(指向同一網站的鏈接)用相對URL指定http:// www ....)。' From [here](http://www.w3schools.com/html/html_links.asp) –

回答

0

確定您輸入的網址正確嗎?

你寫了http//:www.google.co.uk這是一個無效的URL。它應該從http://

+1

我對自己真的很失望。 –