Topic: Initialisation problem after a XMLHttpRequest
Hi and thank's for the great editor.
I have a page where textareas are not available when loading the page, but will occure by replacement of the div content after a XMLHttpRequest query. Then I try to fire tinyMCE, but there is an error message and the browser (FF on MacOSX) hangs trying to load something from the server.
Here is the code. First a XMLHttpRequest is opened and the retrieved code is replacing the div content (element.innerHTML).
...
xrequest.onreadystatechange = function() {
if (xrequest.readyState == 4 && xrequest.status == 200) {
element.innerHTML = xrequest.responseText;
initEditor();
}
}
xrequest.send(null);
...There are two textareas to transform in editors in the retrieved code. The function initEditor looks like this:
function initEditor(){
tinyMCE.init({
mode : "exact",
elements: "u_abstract,u_content",
debug : "true",
langugage: "en"
});
}The debug of TinyMCE is showing that the settings are correct, but then the page loading dies with a javascript error: tinyMCE is not defined. The build in Mozilla javascript console says the bug is there:
document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + tinyMCE.baseURL + '/langs/' + this.settings['language'] + '.js"></script>');A similar code is working flawlessly with FCKeditor, so I can't guess where is the problem.
TinyMCE is firing normally if the textareas are present when loadin the page. I guess the error is related to the later initialisation from within a function. Any ideas?