2013-04-28 146 views
0

它應該如何?更改查詢字符串參數

var text = $(this).siblings("[type=text]").val(); 
document.location = "Default.aspx" + "?id=" + text + "&type=" + query; 
+0

你想完成什麼?請告訴我們結果需要什麼以及HTML的樣子是什麼...... – 2013-04-28 13:19:07

回答

2

屬性的名稱爲window.location,不document.location。另外,您可能需要使用encodeURIComponent來轉義這些值中的一個(或兩個)。

window.location = "Default.aspx" + 
    "?id=" + encodeURIComponent(text) + 
    "&type=" + encodeURIComponent(query);