0

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.

4
  • 1
    show us what you are doing in ViewProduct Commented Mar 29, 2012 at 2:42
  • instantiate SearchClick() in place of ViewProduct() Commented Mar 29, 2012 at 2:44
  • @MatthewBlancarte : could you give me some example MatthewBlancarte? Commented Mar 29, 2012 at 3:04
  • @Shyju : It has many line of codes that's why I don't post in here Shyju. Commented Mar 29, 2012 at 3:05

2 Answers 2

2

You need to check in viewProduct() if you have already shown the menu for that product then do nothing.

Sign up to request clarification or add additional context in comments.

Comments

1

What you should do is empty the menu first in the ViewProduct function. Function already executed can not be skipped.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.