Reputation: 1779
I am trying to figure a way to execute a jQuery function in other page, only after a certain link is clicked from other page. The flow will be:
Page A: click on link to page B.
go to Page B
Page B: execute the function.
If I go directly to page B, no function shaw be executed. Only from that specific link from Page A. How can that be done?
$("uno").toggleClass("open").next().stop().slideToggle();
Upvotes: 1
Views: 46
Reputation: 1606
You can pass any query parameter when link is clicked on Page:A and check this parameter on Page:B, and only execute function on Page:B if that parameter is present.
$(document).ready(function() {
var queryParam = $.url('?search');
if(queryParam) {
// execute your function
}
});
Upvotes: 2
Reputation: 663
You can use document.referrer to check if Page B is directed from Page A and if true, execute the function.
Upvotes: 3