As I work on creating a single-page website with the help of dojo, I refer to tutorials that explain how to utilize dojo/request for ajax requests. The process is straightforward - simply make a request, receive HTML content, and insert it into a designated content panel (div element). This functionality is nicely demonstrated in various samples.
However, as I progress towards loading actual content with specific functionalities, I encounter a challenge. In order to include desired features, I need to add a script element within the requested content obtained through an ajax call. Unfortunately, the scripts integrated with the ajax content do not execute.
I have attempted methods like using contentNode.innerHTML = data;
and
domConstruct.place(data, contentNode, "only");
. While these techniques successfully display the content, the embedded scripts remain inactive.
Based on my understanding, it seems that dijit.layout.ContentPane
would be a more suitable tool for loading content during design time rather than runtime scenarios.
The dilemma arises from the fact that I cannot execute the scripts before the content is fully loaded. Certain essential elements required for processing are only accessible after the main page has been rendered. For instance, customizing form submission behavior necessitates interaction with those dynamic elements post-loading.
Given this situation, I am curious about possible solutions to ensure that the loaded scripts can indeed be executed as intended.