我有這樣一個問題:如何將URL參數添加到在href中給定數據屬性的URL?
的Html
<a href="#2" class="page-link" data-wpurl="?p=2" onmousedown="rwt(this)">2</a>
JS
rwt = function(e){
$(".t-pageholder").load("http://mysite.asd/index.php/".data('wpurl'));
};
我怎麼能去鏈接http://mysite.asd/index.php?p=2
與此代碼?
請正確說出你的問題,究竟是什麼你想在這裏實現什麼? – Varun
不要回避在問題標題中使用「問題」這樣的詞語的警告。更具體一點。我們知道它是一個問題,否則你不會在這裏。 – George
使用'$(e).data('wpurl')'檢索值,並使用'+'輸入字符串concat – Hacketo