[英]How can I make a button redirect my page to another page using a controller action and passing a value using javascript?
[英]How can i redirect to another page using javascript?
有什么方法可以重定向到另一個頁面? 我曾經使用過“ window.location.href = DownlinkPage”
我想訪問downlinkPage,然后獲取頁面文件信息
像fileLink和fileName
有什么方法可以訪問downlLinkPage並從文件中獲取信息?
window.location.assign()
是一種實現方法。 例如,
window.location.assign("http://example.com");
重定向到example.com。
如果你想刪除從歷史的當前頁,更換assign
與replace
。
如果要模擬某人單擊鏈接,請使用
location.href
如果要模擬HTTP重定向,請使用
location.replace
例如:
// similar behavior as an HTTP redirect
window.location.replace("http://stackoverflow.com");
// similar behavior as clicking on a link
window.location.href = "http://stackoverflow.com";
但是之后的代碼將無法執行,整個頁面及其上下文都將被釋放。 您需要下載頁面,解析並從中提取所需信息。 使用jQuery,您可以簡單地:
$.get("downlinkPage", function(data, status){
$($.parseHTML(data)).filter('your desire query');
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.