Hi all,
I'm quite sure there must be something obvious to this that I don't quite get. I'm writing a web app that has different pages that perform different tasks. I use ajax calls to load the "main" area while keeping the "frame" around it stable. This works very well.
I grab a whole file through a call, and get an html treein the "data" field. I add it to my framework like this:
document.getElementById("tablecell").innerHTML = pageDataFetchedFromAjax;
the html works fine, and there's no apparent jscript error. The loaded page contains a function called "fragmentInit" that I'm supposed to call to initialize the page behaviour - but apparently "fragmentInit" is undefined in the framework. The ajax callback is like this:
Code:
function onPageLoaded(oResponse)
{
// Should really check what we get and all that jazz.
//if (oResponse.status == 200)
document.getElementById("centerBlock").innerHTML = oResponse.data;
// Now setup the page
if (typeof fragmentInit != "undefined") {
alert("fragmentInit: "+(typeof fragmentInit));
fragmentInit();
}
}
Assume this function is syntactically correct - it is in the original file... - fragmentInit results in nothing, even if it's present in the loaded page.
The resulting (loaded) block appears in firefox like this:
Code:
<td id="centerBlock" colspan="1"><script type="text/javascript">
////////////////////////////////////////////////////////
// Framework interface - needed on all loaded pages.
function fragmentInit()
{
var desc = makeAjaxDesc( "ajax/gameInfo.php", "datahere", onQueue, window);
RequestManager.send(desc);
}
</script>
Not sure what I'm doing wrong. Any clue how to fix this? I'd rather not use an iframe for a number of reasons.
EDIT: The script block in the second snippet is, in fact, correctly closed.