2016-08-29 43 views
1

我有3頁dashboard.html,documents.jsp,documents.js調用來自不同頁面的另一頁的js函數

在dashboard.html文件我有一個HREF鏈接應該重定向頁面documents.jsp和調用documents.js文件中包含的documents.js文件中的函數。

dashboard.html

<a href="documents.jsp?filter=somefunctiondocumentsjsfile" 

documents.js

在這個文件中,我有一個Ajax調用,比如

function somefunctiondocumentsjsfile(){ 
$.ajax({ 
    url : "DeleteDocument?docId=" + JSON.stringify(selectedItemsToDelete), 
    type: "GET", 
    success: function(data){ 
     console.log(data); 
     showDangerPopup(data); 
     getOfficialDocs(); 
    } 
}); 
} 

我應該如何實現這一

回答

0

只需添加onload="somefunctiondocumentsjsfile()"屬性在開始<body>標記文件。

+0

正如我在我的問題中提到的,我想打電話給href鏈接點擊功能 –

+0

這是不明確的。你可以通過使用'onclick'屬性觸發一個JS函數:'...' – phortx

+0

我認爲你不明白我的問題,我想重定向並同時調用一個函數 –

相關問題