Reputation: 2642
I have one javascript function that used to display the menu and content in my web page. This is how I call this function :
$(document).ready(function () {
ViewProduct(action_name);
});
So after my page load ready, It will call to this function. But the problem is, I have a search text box used to view the product that the user want to search.
function SearchClick() {
if (typeof select_cat != 'undefined' && typeof select_dep != 'undefined') {
action_name = "GetProductByCatSearch";
}else if (typeof select_dep != 'undefined'){
action_name = "GetProductByDepSearch";
}else{
action_name = "GetProductBySearch";
}
ViewProduct(action_name);
}
So when the SearchClick() is called, it produce the menu and product again. Then there are duplicate menu and content.
what I want is to skip the function in document.ready, when the function in SearchClick() is called.
Welcome to all solutions. Thanks so much.
Upvotes: 0
Views: 1571
Reputation: 25776
You need to check in viewProduct()
if you have already shown the menu for that product then do nothing.
Upvotes: 2
Reputation: 160833
What you should do is empty the menu first in the ViewProduct
function. Function already executed can not be skipped.
Upvotes: 1