Basically, I have a page with a "tabbed" div and when a user clicks on one of the tabs there is an .html page loaded into that div. I was wondering is there anyway that I can have a JS function ran on that new data that is loaded from the .load() javascript function.
Here's the function that loads the new data;
function switchAssetTabContent(tabContext, func, params) {
$("#ctl00_ContentPlaceHolder1_Overview1_tcAssetAllocation_tpAssetClassPrimary").html('<table width="375px" height="auto" style="min-height: 100px; height: auto; width: 260px;"><tr><td align="center" valign="middle"><img src="/backoffice/Prospects/App360/images/spinwait.gif" /></td></tr></table>');
var url = "pageFragments/overview/" + tabContext + ".html";
$("#ctl00_ContentPlaceHolder1_Overview1_tcAssetAllocation_tpAssetClassPrimary").load( url +"?" + (new Date().getTime()), params, updateYesterday );
}
the thing is that the data that is loaded is as follows;
<div bgcolor="white" id="ctl00_ContentPlaceHolder1_Overview1_pnlAssetClassAllocation">
<table cellspacing="0" cellpadding="0" style="width: 375px;" border="0">
<tr><td
valign="top"
style="background-color: white vertical-align: top; width: 175px"
id="ctl00_ContentPlaceHolder1_Overview1_tdAssetClassChart">
<div bgcolor="white" style="padding:0" id="AssetClassChartControlDiv" class="chart">
</div>
</td>
<td valign="top">
<div id="ctl00_ContentPlaceHolder1_Overview1_pnlAssetClassLegend">
<input type="hidden" value="" name="ctl00xContentPlaceHolder1xOverview1xuwgAssetClassChartLegend" id="ctl00_ContentPlaceHolder1_Overview1_uwgAssetClassChartLegend" />
<table cellspacing="0" cellpadding="0" border="0" style="overflow: hidden; position: relative;" id="ctl00xContentPlaceHolder1xOverview1xuwgAssetClassChartLegend_main">
<tr id="ctl00xContentPlaceHolder1xOverview1xuwgAssetClassChartLegend_mr">
<td align="left" style="vertical-align: top;">
<div id="AssetClassChartControl_legend" class="legend">
</div>
</td>
</tr>
</table>
</div>
</td></tr>
</table>
</div>
and i have js functions written on the main page that calls that info that uses the ID's of those now loaded html <div>s and <span>s. Can i just put the .js functions on the included page? I just thought i should only include my js functions in the <head></head> or outside of the <body></body> tags.....
any help is greatly appreciated.
updateYesterdaywhen the load request is complete..load()is overwriting the table that was added just before it, are you sure you're loading into the correct place?<img src="…/spinwait.gif" />, so probably yes.