I'm using the window location and the DIV ID of IncludeCMSContent1, IncludeCMSContent2, IncludeCMSContent3 on a single page application. When those conditions are met the external content is injected at the ID.
However, I'm finding that only 1 of the 3 variables is firing, the first one actually, because if IncludeCMSContent3 is present on the page, this ID won't fire because IncludeCMSContent1 is taking precedence.
How can I solve for this? The page is always the same, so the value is always the same, but the ID of IncludeCMSContent1/2/3 will swap on the same page.
var TCEApplicationNoWaiver = "TCEApplication.aspx"
var TCEApplicationWaiver = "TCEApplication.aspx"
var TCEApplicationNotEligible = "TCEApplication.aspx"
if (window.location.href.toLowerCase().indexOf(TCEApplicationNoWaiver.toLowerCase()) >= 0) {
$("#IncludeCMSContent1").load("http://www.example.com/tce-application-noWaiver.htm #externalContent");
}
else if (window.location.href.toLowerCase().indexOf(TCEApplicationWaiver.toLowerCase()) >= 0) {
$("#IncludeCMSContent2").load("http://www.example.com/tce-application-Waiver.htm #externalContent");
}
else if (window.location.href.toLowerCase().indexOf(TCEApplicationNotEligible.toLowerCase()) >= 0) {
$("#IncludeCMSContent3").load("http://www.example.com/not-eligible.htm #externalContent");
}