2

Got a publishing page with two custom sections using javascript.

  • the first is defined on the master page and filling some dropdowns in the left navigation bar
  • the 2nd is defined on the page layout and creates a submenu in the main ContentPlaceHolder

Sometimes the first script is not executed and the dropdowns are not filled. Updating the page by Ctrl-F5 changes this behaviour sometimes. But reentering the page with a new browser instance shows the misbehaviour again.

Maybe the client context of the two scripts are influencing each other? Any advice how to resolve this?

Setting a jquery timeout is a workaround but is it a good one?

  • 2
    A jquery timeout is a sign that your asynchronous code is poorly implemented. Without seeing the code that's about all anyone can say. – Derek Gusoff Jul 12 '17 at 13:24
  • If possible, post some codes too.. – Aakash Maurya Jul 12 '17 at 13:27
  • If you are using global variables in your script, then avoid using them. Instead wrap your code within functions and try to call those function on page load. – ThinkB4Code Jul 12 '17 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.