I have created custom master page for SharePoint online. I use in my master page some JavaScript, including JQuery. This master page contains Content By Search Web Part (CSWP), and the code for CSWP was generated from snippet tool in design manager. For CSWP I have created custom display template (both control and item). Base on my tests results CSWP results are injected with JavaScript into master page at the end of master page render process. And I have question. Is it possible to reference somehow values from CSWP to master page? CSWP returns some material index which I would like to use in master page code. For example with JQuery.

1 Answer 1


Maybe with AddPostRenderCallback?

More on http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2014/02/13/for-tips-for-using-jquery-with-sharepoint-display-templates.aspx

  • AddPostRenderCallback is used in display template, and I would like to get access from master page to CSWP. So customization in display template will be injected with JavaScript into master page and it's not available to me in master page. I can imagine global variables in display template, but it looks like crazy idea? Dec 17, 2015 at 15:32

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.