Is there a method of flushing or registering inline variables prior to external scripts are loaded?
i.e. Have a script block at the top of the MasterPage.Master Body
<script type="text/javascript">
var promoteSuggestionID = "<%= SuggestionID %>";
</script>
Bundled Script at the bottom of the Page Body.
<%: Scripts.Render("~/scripts/Timeline") %>
Timeline script
(function (TimeLine) {
TimeLine.PromoteSuggestion = promoteSuggestionID;
//....Main body of script
}((window.TimeLine) ? window.TimeLine : (window.TimeLine = {})));
using Chrome the following error is shown when the line in the timeline script is hit.
Uncaught ReferenceError: promoteSuggestionID is not defined(anonymous function)
Previously we were loading the timeline script via modernizer. When I use chrome i can see that the default.aspx code has the promotedSuggestionID set if i put a breakpoint on the Timeline.PromotedSuggestion code. Its as if this scriptblock hasn't been registered yet, is there a way i can set the priority?
promoteSuggestionIDis defined at the very top of the body andTimelineis loaded at the bottom this should work. Isn't there any other error? Are you sureTimelineis loaded afterpromoteSuggestionIDdefinition?