If you have created custom HTML with the code editor, you can load it dynamically with an Ajax call. This can be used to e.g. display a box with search tips.
Loading HTML with Ajax
The normal URL structure for custom 1 through 20 loads an HTML page including script, the HTML head and the HTML body with your custom HTML inserted.
If however you want to just load the HTML exactly as you entered it, then you can use a different URL instead (Flex only). For example: “/custom/5/ajax.html” will load the HTML that you have added in the code editor for custom page 1 (which has id 5). The id’s that you need to use are between brackets in the code editor. E.g. “Custom page 1 (5)”. To load custom 10, use parameter 30 – and so on.
Clicking on the icon will now call the function “loadtips” of the “tipspopup” object.
We can now add the object “tipspopup” to the “client script” in the code editor:
The above example uses the Infradox library function “showmaskcallback” with has a callback function as its parameter. This will display a modal mask and we insert the HTML that we fetch with the Ajax call “$.get()” into it. You will of course need to add CSS to style and position the popup. Because the custom HTML is inserted as a child of the modal mask, we can simply remove the mask to close the popup. Note that you can use the function “tools.gettopmask()” to get the id of the top most mask.