2016-04-26 22 views

回答

0

嘗試

<a href='components/home/singleActivity.html?view=Search&test2=New'> 
 
MyLink 
 
</a>

0

爲了發送該參數的URL,你DONOT需要附上內部報價的價值('')或雙引號("")。你只需要發送的值(或多個值),如下圖所示..

components/home/singleActivity.html?view=search&secondvalue=anythingthatyouthinkof 

也請記住,你需要跟蹤的URL編碼的。

而用於檢索參數this thread詳細解釋它。

2

它應該是不帶引號components/home/singleActivity.html?view=search發送兩個參數加入他們與&

components/home/singleActivity.html?foo=bar&baz=quux 

讀他們在JavaScript中使用此代碼:

var params = {}; 
location.search.slice(1).split("&").forEach(function(pair) { 
    pair = pair.split("="); 
    params[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]); 
}); 
0

要發送,您可以使用?view=search&key2=value2&key3=value3多個值和等等。

此外,要訪問這些參數,您可以使用window.location訪問URL。

喜歡的東西

var params = window.location.split('?')[1]; 

這之後給你的一切嗎?在URL中。

+0

拆分是字符串的方法不是函數。 – jcubic

+0

我的不好。編輯;-)謝謝 –

相關問題